Is there a way to monitor all the services on a system that must start in "automatic mode" and they aren't "started" without configuring a rule for every service?
Thanks.
Configure services monitor
Script to monitor failed auto services
Hi,
Here is a script that we use - it uses wmi to query for all services whos start type = auto and status <> started. Returns the name(s) of the failed services.
Here is the code - it is a bit rough but you should get the drift.
Nick
Here is a script that we use - it uses wmi to query for all services whos start type = auto and status <> started. Returns the name(s) of the failed services.
Here is the code - it is a bit rough but you should get the drift.
Code: Select all
Option Explicit
const statusAlive = "Host is alive:"
const statusDead = "No answer:"
const statusUnknown = "Unknown:"
const statusNotResolved = "Unknown host:"
const statusOk = "Ok:"
const statusBad = "Bad:"
const statusBadContents = "Bad contents:"
'---- entry point ----
FUNCTION performtest()
Dim strComputer, qryWMI, failedservices, objWMIService, colServices, objService
IF "%Reply%"="%"+"Reply"+"%" THEN
performtest = statusUnknown+"Please enable 'Translate macros' option"
ELSE
' query all services that are stopped and startup type is auto
strComputer = "."
qryWMI = "Select * from Win32_Service where State='Stopped' AND StartMode='Auto' "
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colServices = objWMIService.ExecQuery(qryWMI)
IF colServices.count > 0 THEN
For Each objService in colServices
failedServices = failedServices & objService.DisplayName & " "
Next
PerformTest = statusBAD & failedservices
ELSE
PerformTest = statusOK
END IF
END IF
END FUNCTION