Manage Windows service recovery with program execution

When a Windows service will not run, it can be a very frustrating experience for Windows administrators. IT guru Rick Vanover offers admins sanity saving tips.

As long as Windows has been able to run a service, administrators have had to deal with Windows services fail and stop running. Windows offers the computer response configuration to address a failed service, but too many times, that does not restart the service correctly. (I have relied on Windows to restart the service, even though I know that it may not work right.) Though the root cause of the failure can vary, the problem is usually a third-party application or a resource issue.

For critical services, the Run A Program option is one way to add an additional level of notification for this situation. For the program to run on a service failure, a PowerShell script, a .VBS script, or a .BAT file is crafted that notifies administrators of the service failure, and then attempts to restart the service can shorten the response time of failures. Figure A shows the Run A Program option configured for a service. Figure A

Click the image to enlarge.

Other options such as Restart The Computer may be a little extreme; I'd want to intervene before an automatic reboot is launched because I can imagine an infinite loop of reboots. In terms of what program to run, the best option is running something small and easy in an automated fashion. (PowerShell scripts take a little more work to run in this context compared to .BAT and .VBS files.) Also, if an email being sent is part of the task, you may need to install an email client such as Microsoft Outlook. I'm not a fan of that on servers, but other email clients may be an option as well. In terms of response for a service that has failed, I'd prefer to receive an email rather than a page if it is a critical service and possibly configure the script to send the result of the restart operation.

Any availability feature that admins can implement to reduce the response time for pesky services is welcomed. Unfortunately, many times we're cornered with applications we can't remedy on our own, or the software vendor does not provide enough support for the service.

In the discussion, share tricks that you have implemented to increase availability of Windows services.