Free solution to monitor windows services?

Soldato
Joined
18 Oct 2002
Posts
5,586
Location
Stone, Staffordshire
I've got a service on my server that sometimes fails to start.

Is there a program that I can use that I can schedule to run every 10 mins that will try and start the service if it's not running? Ideally if it could email me too that would be great!!
 
you can tell a service to constantly restart any way.
and you can create a task (alert) to email using al the built in tools of windows server.
 
Code:
sc query spooler | findstr /i "STATE" | findstr /i "RUNNING"

This will set the errorlevel to 0 if the Spooler service is running. If it's not running, it will give errorlevel = 1

So after running that command, have it do the following.

Code:
If %errorlevel%==0 goto running

Echo Spooler is not running
net start spooler

(optional)
COMMANDS FOR SENDING EMAIL.  To say it's been restarted
(/optional)


goto end

:running
echo Service is running. goto end

:end


This is a great resource

http://ss64.com/nt/sc.html
 
Last edited:
Back
Top Bottom