I have infinite loop PowerShell (Testing purpose) script, which I want to run as a Service in Windows Server 2008 R2 (Standard).
I'm using the following command to create the Windows service,
sc.exe create "My PS1Service" binPath= "powershell.exe -NoLogo -Path D:\TEST\test.ps1"
And the result is [SC] CreateService SUCCESS
But when I try to run the service My PS1Service
, it return the following error
Windows Could not srart the My PS1Service service on Local
Computer
Error 1053: The service did not respond to the start or control
request in a family
Any help here !!!
get-help New-Service
. Also specify the full path topowershell.exe
– BethSystem.ServiceProcess.ServiceBase
. Are you doing anything like that in test.ps1? – Hannahsc.exe
. But the service will never state that it was started successfully, which kind of defies the purpose. – Aeneas