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

I have a Windows service that exits unexpectedly every few days. Is there a simple way to monitor it to make sure it gets restarted quickly if it crashes?

share|improve this question

Under the Services application, select the properties of the service in question.

View the recovery tab - there are all sorts of options - I'd set First & Second Failure to Restart the Service, Third to run a batch program that BLAT's out an email with the third failure notification.

You should also set the Reset Fail Count to 1 to reset the fail count daily.


Looks like you can do this via a command line:

SC failure w3svc reset= 432000  actions= restart/30000/restart/60000/run/60000
SC failure w3svc command= "MyBatchFile.cmd"

Your MyBatchFile.CMD file can look like this:

blat - -body "Service W3svc Failed" -subject "SERVICE ERROR" -to -server -f
share|improve this answer
All good stuff, but +1 especially for the email notification advice and the command-line stuff. – Le Comte du Merde-fou Jul 31 '09 at 18:27
Where should the batch file live on disk? – Matt Jan 2 '15 at 19:38
Anywhere. With SC failure w3svc command= "MyBatchFile.cmd" it should be in the path or C:\Windows\System32. You can put it in any directory if you use a full path i.e. SC failure w3svc command= "c:\Stuff\MyBatchFile.cmd" – Christopher_G_Lewis Jan 2 '15 at 22:19

Open Services.msc, double-click on the service to open the Properties of the service, there is a Recovery tab and those settings should allow you to restart the service upon failure.

share|improve this answer

I am using ServiceKeeper on my windows 2008 server at and it works very good. Previously, I had a review on ServiceHawk, but I prefer to use ServiceKeeper for its easier management and interface.

share|improve this answer

This was my answer on a similar thread Hope this helps...

You can schedule a simple vbs script like this one to restart periodically the service on the computer if needed.

strComputer = "." 
set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
set objService = objWMI.Get("Win32_Service.Name='" & strSvcName & "'")
If objService.State= "Stopped" Then
End If

share|improve this answer

Someone asked a similar question over at Super User: You could install a tool that monitors windows services. Something like Service Hawk would help you keep the services started, or allow you to schedule automatic restarts (possibly during the night) to keep the service running smoothly.

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.