Aug 282014


All PowerShell Versions

To test whether a particular service is still responding, use a clever trick. First, ask WMI for the service you want to check. WMI will happily return the process ID of the underlying process.

Next, look up this process, and the process object will tell you whether the process is frozen or responding:


This example would check whether the Spooler service is still responding:

PS> Test-ServiceResponding -ServiceName Spooler

Note that the example code assumes that the service is running. If you wanted to, you could add a check to exclude non-running services yourself.

Leave a Reply