I have need to schedule a job in SQL to stop a service on a remote computer, run another job and then to start the service again.
Using sysinternals psservice I can do this from my SQL server from a batch file but have not succeeded in getting this to run from the query.
In my batch file to successfully stop the service I have
c:\_Sysinternals\PsService.exe \\server.xxx.com -u username -p password stop ServiceName
I have tried
EXEC master..xp_CMDShell '"c:\_Sysinternals\PsService.exe" \\server.xxx.com -u username -p password stop ServiceName'
but this runs indefinitely and does nothing.
Please advise the correct syntax.