Batch script to restart IIS services. Can be modified for other purposes.

If you have ever had a server that is has difficulty with the iisreset command, this may help.  In my testing it works on everything from Windows 2000 to 2008R2.  Your mileage may vary. We use this to automate resets on a stubborn server.

Using Simple Server Monitor, we check a website for a response. If no response is given, then this script will fire. Simple Server Monitor has the ability to pass parameters to the command line and makes this an easy solution.

This batch script will first check to see if the specified services are running, attempt to stop them, restart them, check to see if they are running and if they do not start after a few tries, reboots the system.

 

Thanks to Rob van der Woude’s Scripting Pages for the help getting this one off the ground.

Comments are closed.