Hi, im trying to restart a Windows service in a remote machine, i used the following PS script:
Restart-Service -Name "NETA Schedulatore Amministratore Service"
But the job always fails with this output:
[ERROR ] Execution finished with the following error (winrm-exec.py:378)[root]
[ERROR ] Waiting for service 'NETA Schedulatore Amministratore Service (NETA Schedulatore Amministratore Service)' to start...Waiting for service 'NETA Schedulatore Amministratore Service (NETA Schedulatore Amministratore Service)' to start...Waiting for service 'NETA Schedulatore Amministratore Service (NETA Schedulatore Amministratore Service)' to start...Waiting for service 'NETA Schedulatore Amministratore Service (NETA Schedulatore Amministratore Service)' to start...Waiting for service 'NETA Schedulatore Amministratore Service (NETA Schedulatore Amministratore Service)' to start...Waiting for service 'NETA Schedulatore Amministratore Service (NETA Schedulatore Amministratore Service)' to start...Waiting for service 'NETA Schedulatore Amministratore Service (NETA Schedulatore Amministratore Service)' to start...Waiting for service 'NETA Schedulatore Amministratore Service (NETA Schedulatore Amministratore Service)' to start...Waiting for service 'NETA Schedulatore Amministratore Service (NETA Schedulatore Amministratore Service)' to start...Waiting for service 'NETA Schedulatore Amministratore Service (NETA Schedulatore Amministratore Service)' to start...Waiting for service 'NETA Schedulatore Amministratore Service (NETA Schedulatore Amministratore Service)' to start...Waiting for service 'NETA Schedulatore Amministratore Service (NETA Schedulatore Amministratore Service)' to start... (winrm-exec.py:379)[root]
Failed: NonZeroResultCode: [WinRMPython] Result code: 1
Execution failed: 50 in project winupdates: [Workflow result: , step failures: {1=Dispatch failed on 1 nodes: [ITALGASSVI-AS: NonZeroResultCode: [WinRMPython] Result code: 1 + {dataContext=MultiDataContextImpl(map={ContextView(step:1, node:ITALGASSVI-AS)=BaseDataContext{{exec={exitCode=0}}}, ContextView(node:ITALGASSVI-AS)=BaseDataContext{{exec={exitCode=0}}}}, base=null)} ]}, Node failures: {ITALGASSVI-AS=[NonZeroResultCode: [WinRMPython] Result code: 1 + {dataContext=MultiDataContextImpl(map={ContextView(step:1, node:ITALGASSVI-AS)=BaseDataContext{{exec={exitCode=0}}}, ContextView(node:ITALGASSVI-AS)=BaseDataContext{{exec={exitCode=0}}}}, base=null)} ]}, status: failed]
If i check on the target node the service is effectively stopped then started (checked on the Event Viewer) but i don't know why the job fails.
I used the same script with other services and the run is OK, seems only with this service (i must say that this service takes a while to stop and restart).