Partilhar via


Check Service State using Desired Configuration Monitoring (DCM) Solution

Many a times you would have a need to check if a particular service is running. With the DCM Solution Accelerator you can create a rule to check for the status of a Service and alert if the status is not in the state you desired. I am going to show you how to achieve this. Ask yourself the same two questions. The first one you already know that you want to check for the state of a service! J

  • Where is the service information located?

      In the WMI under the namespace root\cimv2 and under the WMI class Win32_Service. The property to check is State

 

  • What is the desired value of the service status?

Running

 

Here are the details:

  1. Create a WMI data source and fill the appropriate properties

Name: WMI DS

Namespace: root\cimv2

WMI Class Name: Win32_Service

Where Clause of WQL: Name='Bits'

The reason I specified the Where clause is because Win32_Service class in WMI contains all the services as different instances. I am interested in checking the status of the BITS service alone.

 

  1. Create a Setting under the WMI data source and fill the appropriate properties

Property: State

 

  1. Create a Rule under the Setting and fill the appropriate properties

Rule Name: CheckServiceState

Rule Type: Active

Rule Query: State != Running (read my earlier post on how to create rules)

Event Description: The BITS service is not Running

Event ID: 123

Severity: Error

 

Commit and Save the manifest! You are done. Attached is the xml file! Oh, remember to change the service name in the Where Clause to check for the service you want.

service.xml