I want to create a windows service from a long running process. I'm able to create the service but I cannot execute it in any way.
I've also tries a very simple timeout.exe
process with the same results.
> New-Service `
-Name "test" `
-BinaryPathName "C:\windows\system32\timeout.exe 30"
// output
Status Name DisplayName
------ ---- -----------
Stopped test test
After that, I'm trying to start service with
Start-Service test
And i receive IMMEDIATELY this output:
Start-Service: Service 'test (test)' cannot be started due to the following error: Cannot start service 'test' on computer '.'.
On event viewer are presente 2 event logs that are referencing a 30 seconds timeout that never happens: the system fails immediately.
What I am missing ?