Check For Not Running Services In Automatic Mode

9 בנובמבר 2009

אין תגובות

Ever needed to get alerts on all services that are set to Automatic but not running?

Use the following SCOM monitor to do just that:

1. Create a Unit Monitor of type “Timed script two state monitor”, call it “Check For Not Running Services In Automatic Mode” or name it whatever you want

2. Check of “Monitor is enabled” (we will enable it to run only on specific servers later with overrides)

3. Monitor target – Agent

4. Put the following script:

Call Main ()

Sub Main()

' Monitor if automatic process is not running

Dim oAPI, oBag, wshShell
Set oAPI = CreateObject("MOM.ScriptAPI")

Set wshShell = WScript.CreateObject( "WScript.Shell" )
strComputer = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )

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

Set colListOfServices = objWMIService.ExecQuery _
("Select * from Win32_Service Where StartMode = 'Auto'")

For Each objService in colListOfServices
Set oBag = oAPI.CreatePropertyBag()
If Not objService.Started = True Then
strDesc = "Service " & objService.Caption & " is not running on " & strComputer

Continue reading this post on our new blog – Check For Not Running Services In Automatic Mode

הוסף תגובה
facebook linkedin twitter email