Querying WMI for DCM Events
Author: jason
Date: 2007-05-04 15:06:31
Category: Technical

DCM records the results of a scan to an output XML file, the event viewer, and a WMI repository. DCM can log it's events to the WMI via the RunDCM.bat. The following switch "WMIEvents:Enable" enables WMI inside the RunDCM.bat file, it's on by default.

The DCM WMI repository is root\DCMSolution. The class that holds the DCM events is DCMClass. The objects in the class are: ComputerName, SettingName, ActualValue, DesiredValue, ErrorDescription, ErrorID, ErrorSource, GUID, ManifestName, RepeatCount, TimeOfFirstInstance, and TimeOfLastInstance.

Below is a simple script to read the DCM WMI repository.
Create a new text file and name it: dcm_wmi.vbs

Code

'Query to check the WMI for DCM events
'Resume next instruction on error
On Error Resume Next

strComputer = "."

'WMI Core Section
Set objWMI = GetObject("winmgmts:" & "{impersonationLevel=impersonate,(Security)}!\" & strComputer & "rootDCMSolution")
Set colDCMEvents = objWMI.ExecQuery ("Select * from DCMClass")

For Each objItem in colDCMEvents

MsgBox "Computer name: " & objItem.ComputerName & VbCr & _
"Setting: " & objItem.SettingName & VbCr & _
"Actual Value: " & objItem.ActualValue & VbCr & _
"Desired Value: " & objItem.DesiredValue & VbCr & _
"Error Description: " & objItem.ErrorDescription & VbCr & _
"Error ID: " & objItem.ErrorID & VbCr & _
"Error Source: " & objItem.ErrorSource & VbCr & _
"GUID: " & objItem.GUID & VbCr & _
"Template Name: " & objItem.ManifestName & VbCr & _
"Repeat Count: " & objItem.RepeatCount & VbCr & _
"Time Of First Instance: " & objItem.TimeOfFirstInstance & VbCr & _
"Time Of Last Instance: " & objItem.TimeOfLastInstance
Next


Double-click it to run
It should look like:




References
DCM 2.0 Download
DCM blog
Technet DCM



jason @ jasonthomasfrance.com - www.masterstationlog.com - copyright 2009