Home » System Center Operations Manager 2007 » Check StartMode = “Auto”

Check StartMode = “Auto”

I have seen a lot of questions about checking all services that are configure to start automatically. This can be done with a script. This script checks if the service is configure to start automatic, if it is and it is not running, a warning event will be written in the local application log. You can then pickup that event with Operations Manager and generate an alert.

strComputer = “.”
Set objWMIService = GetObject(“winmgmts:” _
    & “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2”)

Set colListOfServices = objWMIService.ExecQuery _
        (“Select * from Win32_Service”)

For Each objService in colListOfServices

If (objService.StartMode = “Auto”) and (objService.State = “Stopped”) then

Const EVENT_WARNING = 2
Set objShell = CreateObject(“Wscript.Shell”)
objShell.LogEvent EVENT_WARNING, _
 “Service ” & objService.DisplayName & ” is not running. (” & objService.Name & “)”
End If
Next

Remember to test scripts in a test environment first.