Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

Is there anyway, on Windows machine, to automatically restart a certain windows service?

share|improve this question
up vote 3 down vote accepted

you could create a scheduled task restarting the service with net stop and net start.

share|improve this answer

The quick and dirty way would be to setup a scheduled task to run the following command line.

sc.exe stop <serviceName> && sc.exe start <serviceName>

To create this scheduled task to run every midnight via the command line:

SCHTASKS /Create /TN "Restart Service"  /TR "sc.exe stop <serviceName> && sc.exe start <serviceName>" /SC DAILY /ST 00:00 /RU SYSTEM /F

You could of course add far more intelligence and logging to this process. Maybe even write a full Powershell script around the Get-Service CMDLet. If you would rather not create a separate local account (preferred) to run this scheduled task, you can use the account 'System' without a password.

share|improve this answer

Your best bet would be to use something like Service Hawk. It has a feature built-in that allows you to restart services automatically on a user-defined schedule.

share|improve this answer

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.