Create Widows Service from batch or exe file

I need to distribute some app to all our stations without users having the ability to close the app.

The app jumps on users’ screen and notifies them to restart the computer, and I don’t want users to be able to close this app through task manager.

Our users all have local admin privileges, and I couldn’t find a way to stop them from closing the app.

So I thought to create a service that runs this app and define the service as unstoppable and uninstallable.

I created the service in this way:

sc create "PU-Restart" binPath= "C:\PURrestart\PURrestart.exe"

But when I start the service, I get this error:

Windows could not start the PU-Restart service on Local Computer. Error 1053: The service did not respond to the start or control request in a timely fashion.

I would welcome any help find a solution to it.
Thanks
Haim

Answer

Unfortunately windows doesn’t give you the ability/authority to interact with users directly. Services after all do not have interfaces and run on the background even when the user is logged out.

https://stackify.com/what-are-windows-services/

Also about the error, its probably because you didn’t implement the Windows Services Control Manager’s states (start, stop, pause etc.). They act like event handlers when someone starts stops or pauses a service. By default, the Service Control Manager will wait 30 seconds for a service to respond (basically for the start handler) and if the service hasn’t responded then it will throw the error you describe.

Attribution
Source : Link , Question Author : Haim Ben , Answer Author : clumsypr

Leave a Comment