Author Posts

September 19, 2016 at 7:41 am

Hi All,

I have an executable file (MyTask.exe). Now I want to make it as a service so whenever we start it in services.msc it will start the exe file and so on.

Can anyone have any idea how this can be done.

September 19, 2016 at 8:19 am

get-help New-Service

September 19, 2016 at 8:44 am

I tried with the below command, it created the Service in Services.msc

PS C:\windows\system32> New-Service -Name "Test" -BinaryPathName "C:\Users\amarnath.mahato\Desktop\My Docz\Backup\Powe
hell Scripts\Exe Files\LastBootUpTime.exe -k netsvcs" -DisplayName "Test" -StartupType Manual -Description "This is a
st service."

Now when I am trying to start it, it throwing the below ERROR :

The Test service failed to start due to the following error:
The service did not respond to the start or control request in a timely fashion.

Error code -> 1053

Any suggestion on this.. I am running is locally, and am local admin as well?

September 19, 2016 at 12:13 pm

You can't just run any old executable file as a service directly. They have to be written to work that way. If you want to run something else as a service, there's an old tool called SrvAny.exe that can help with that.

September 19, 2016 at 12:39 pm

As Dave mentioned SrvAny is very old and I believe only available in equally old Windows resource kits which are difficult to get these days. You can download and use a tool which provides the same functionality but it is still under active development call NSSM – the Non-Sucking Service Manager.

https://nssm.cc/