Remote start and stop of service

wheelgunr
wheelgunr used Ask the Experts™
on
I have a need for my backup server to stop  and  then restart a remote server's service to improve throughput. I have the following PSTools command string:

psexec \\xxx.xxx.xxx.xxx -u domain\username-p Password -w C:\services cmd  svcstop.bat (opposite is svcstart.bat.)

Everything seems to go well, but this stops at the remote folder C:\services, and then just sit there.

Cam anyone recommend a fix for this, or suggest a better way? The target server is a 2008 R2n and the BU server is a 2008 R2 Enterprise.

Thanks in advance for any input and help.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
what do you mean by "stops at the remote folder C:\services"?
you mean it doesn't stop the service?
 
can you  share the contents of the batch files?
 
Have you tried SC command? (needs to be done from elevated prompt)
SC \\COMPUTERNAME stop "SERVICENAME"
SC \\COMPUTERNAME start "SERVICENAME"
 
or even psservice instead of psexec

Author

Commented:
Perfect! Exactly hat I needed! Thank you very much.

Author

Commented:
Set in an elevated shortcut to a batch file, the SC command works perfectly.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial