Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking for a way to restart Windows services

  • from batch scripts (preferrably CMD)
  • on a remote machine
  • using a different account than the one the script is running as

Looking at the parts that I already have in place, the missing bits are:

  • runas does not provide a way to specify the password, so I can't call the remote machine with the appropriate account
  • There seems to be no command line equivalent of the restart button in services.msc, so I would have to implement this myself by polling sc query

Are there any standard solutions to these issues?

share|improve this question
up vote 1 down vote accepted

There is a way to restart services by using sc stop and sc start or net stop net start, if using net, then you have to use real name of service (as in sc query).

For remote connection to Windows and run batch commands under another use, you can use PsExec from systeminternals.

share|improve this answer
Thanks for the psexec hint, that was the missing bit. I can now run the start/stop command directly on the remote machine, e.g. psexec \\servername -u username -p password sc stop ServiceName – themel Dec 3 '12 at 20:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.