Dell Client Batteries Health Status(Periodic)

Dell.WindowsClient.ClientBatteriesUnitUnitMonitor (UnitMonitor)

Unit Monitor to calculate Dell Client Batteries Health Status Periodically.

Knowledge Base article:

Summary

This Health Monitor fetches the State of the Dell Battery Sensor. The status can be one of the following three types:

Success: The battery sensor has returned to a normal state.

Warning: The battery sensor is reporting a warning state.

Critical: The battery sensor has failed.

Causes

Warning: A Warning status may display if a battery sensor in the specified client system is in a throttled state.

Critical: A Critical status may display if a battery in the specified client system has failed, is disabled, has a configuration error, or experienced a thermal trip. See the product knowledge of the last modified OMCI / Dell Command | Monitor alert that caused the state change for additional details.

Resolutions

Perform the following steps for the Warning and Critical messages:

Warning: A Warning message indicates a possible future problem. Plan to replace the failed battery sensor, based on the impact to operations, if the battery sensor status goes to a critical state.

Critical: A Critical message indicates actual or imminent loss of data or loss of function. Change the failed battery sensor. See the product knowledge of the last modified OMCI / Dell Command | Monitor alert that caused the state change for additional details.

When the issue has been resolved, the status changes to Success in the next polling cycle.

Element properties:

TargetDell.WindowsClient.Sensors
Parent MonitorSystem.Health.AvailabilityState
CategoryAvailabilityHealth
EnabledTrue
Alert GenerateTrue
Alert SeverityError
Alert PriorityNormal
Alert Auto ResolveTrue
Monitor TypeMicrosoft.Windows.TimedScript.ThreeStateMonitorType
RemotableTrue
AccessibilityInternal
Alert Message
Dell Client Batteries Health Status(Periodic)
Battery Health status is critical
RunAsDefault

Source Code:

<UnitMonitor ID="Dell.WindowsClient.ClientBatteriesUnitUnitMonitor" Accessibility="Internal" Enabled="onEssentialMonitoring" Target="Dell.WindowsClient.Sensors" ParentMonitorID="SystemHealth!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="Windows!Microsoft.Windows.TimedScript.ThreeStateMonitorType" ConfirmDelivery="true">
<Category>AvailabilityHealth</Category>
<AlertSettings AlertMessage="Dell.WindowsClient.ClientBatteriesUnitUnitMonitor_AlertMessageResourceID">
<AlertOnState>Error</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>Normal</AlertPriority>
<AlertSeverity>Error</AlertSeverity>
</AlertSettings>
<OperationalStates>
<OperationalState ID="Dell.WindowsClient.ClientBatteriesUnitSuccess" MonitorTypeStateID="Success" HealthState="Success"/>
<OperationalState ID="Dell.WindowsClient.ClientBatteriesUnitWarning" MonitorTypeStateID="Warning" HealthState="Warning"/>
<OperationalState ID="Dell.WindowsClient.ClientBatteriesUnitFailure" MonitorTypeStateID="Error" HealthState="Error"/>
</OperationalStates>
<Configuration>
<IntervalSeconds>3600</IntervalSeconds>
<SyncTime/>
<ScriptName>ClientBatteriesUnitMonitor.vbs</ScriptName>
<Arguments>$Config/Computer$</Arguments>
<ScriptBody><Script>
'**********************************************************************************
' Script Name - Dell Client Discovery
' Author: Manoj Kumar Bora
'
' Description:
' Discover Dell Client and components for a Dell Client with OMCI / Dell Command | Monitor Instrumentation
'
' (c) Copyright Dell Inc. 2007-2012 All rights reserved
'**********************************************************************************

Option Explicit
On Error Resume Next
SetLocale("en-us")
Dim oArgs
Set oArgs = WScript.Arguments
if oArgs.Count &lt; 1 Then
Wscript.Quit -1
End If

Dim logMessage, targetComputer, DebugScript, logLevel, objLogTextFile, objLogFSO
targetComputer = oArgs(0)
logLevel = 0
DebugScript = false
' Begin Logheader
If logLevel &lt;&gt; 0 Then
Dim fileSize, strOutFile
Const strFileName = "Monitor_DellWindowsClient_Battery.log"
Const ForAppending = 8
Const ForWriting = 2
Const MaxFileSize = 524288 'File Size is limited to 512 KB

dim wsShell : Set wsShell = Createobject("WScript.Shell")
dim wshSysEnv : Set wshSysEnv = wsShell.Environment
dim tFolder : tFolder = wshSysEnv("TEMP")
dim wshPrcEnv : Set wshPrcEnv = wsShell.Environment("Process")
tFolder = Replace(tFolder, "%SystemRoot%", wshPrcEnv("SYSTEMROOT"), 1, -1, vbTextCompare)

Set objLogFSO = CreateObject("Scripting.FileSystemObject")
If Not objLogFSO.FolderExists(tFolder) Then
objLogFSO.CreateFolder(tFolder)
End If
strOutFile = tFolder &amp; "\"&amp; strFileName
If Not objLogFSO.FileExists(strOutFile) Then
Set objLogTextFile = objLogFSO.CreateTextFile(strOutFile)
objLogTextFile.Close()
End If
fileSize = objLogFSO.GetFile(strOutFile).Size
If (fileSize &gt; MaxFileSize) Then
Set objLogTextFile = objLogFSO.OpentextFile(strOutFile, ForWriting, True)
Else
Set objLogTextFile = objLogFSO.OpentextFile(strOutFile, ForAppending, True)
End If
logMessage = "INFO: Script - Dell Client Battery Monitoring : Start()"
MOMDebugLog 1, logMessage
Err.Clear
End If

Sub MOMDebugLog (ByVal debugLevel, ByVal Message)
On Error Resume Next
DebugOut Message
If (debugLevel &gt; 0) and (debugLevel &lt;= logLevel) Then
objLogTextFile.WriteLine(Now() &amp; " ---- " &amp; Message)
Err.Clear
End If
End Sub
' End of Logheader

Class ClientType
Private m_typeSupport
private m_pairObj

Public Default Function Init(pairs)
PairObj = pairs
Set Init = Me
End Function

private Function SanitizeValue(val)
LogMessage ="Val" &amp; val
MOMDebugLog 1, logMessage
SanitizeValue = val
'val = trim(val)
if ((val = "") or isNull(val) ) Then SanitizeValue = "Not Available"
End Function

public Property Get PairObj
PairObj = m_pairObj
End Property
Public Property Let PairObj(value)
m_pairObj = value
End Property

public Property Get IsTypeSupport
Dim nameValue, nameValueList
Dim fetcherObj, i

Set fetcherObj = New Fetcher
nameValueList = fetcherObj.GetClientName(m_pairObj(0))
LogMessage ="C11" &amp; UBound(nameValueList)
MOMDebugLog 1, logMessage
For i=0 to UBound(nameValueList) -1
LogMessage ="C22 " &amp; nameValueList(i)
MOMDebugLog 1, logMessage
if InStr(nameValueList(i),"nb") Then
logMessage = "NB "
MOMDebugLog 1, logMessage
IsTypeSupport = true
ElseIf InStr(nameValueList(i),"dt") Then
logMessage = "dt "
MOMDebugLog 1, logMessage
IsTypeSupport = false
end If
Next
End Property
Public Property Let IsTypeSupport(value)
m_typeSupport = SanitizeValue(value)
End Property

End Class

Class HealthComputer

Private m_fetcherObj
private m_pairObj
private m_batteryHealth
private m_omciVersion

Public Default Function Init(pairs, omciVer)
PairObj = pairs
m_omciVersion = omciVer
Set Init = Me
End Function

private Function SanitizeValue(val)
LogMessage ="Val" &amp; val
MOMDebugLog 1, logMessage
SanitizeValue = val
'val = trim(val)
if ((val = "") or isNull(val) ) Then SanitizeValue = "Not Available"
End Function

public Property Get FetcherObj
FetcherObj = m_fetcherObj
End Property
Public Property Let FetcherObj(value)
m_fetcherObj = SanitizeValue(value)
End Property

public Property Get PairObj
PairObj = m_pairObj
End Property
Public Property Let PairObj(value)
m_pairObj = value
End Property

public Property Get BatteryHealth
Dim Status, battStatus
LogMessage ="BatteryHealth "
MOMDebugLog 1, logMessage
Dim fetcherObj, errorFlag, warningFlag
Set fetcherObj = New Fetcher
Status = fetcherObj.GetHealthStatus(m_pairObj(0))

Dim b, versionNum
b = split(m_omciVersion, ".")
versionNum = b(0)

errorFlag = 0
warningFlag = 0
For each battStatus in Status
LogMessage ="BatteryHealth " &amp; battStatus
MOMDebugLog 1, logMessage
If battStatus = "Degraded" OR battStatus = "Stressed" OR battStatus = "Pred Fail" OR battStatus = "Starting" OR battStatus = "Stopping" OR battStatus = "Service" OR battStatus = "Replacement Needed" Then
warningFlag = 1
logMessage = "War"
MOMDebugLog 1, logMessage
ElseIf battStatus = "Error" OR battStatus = "NonRecover" OR battStatus = "Stopped" OR battStatus = "No Contact" OR battStatus = "Lost Comm" Then
errorFlag = 1
logMessage = "Err"
MOMDebugLog 1, logMessage
ElseIf versionNum &gt; 7 Then
logMessage = "No batt"
MOMDebugLog 1, logMessage
' Dim client_Type, clientSupport, omciObj
' Set omciObj = iomciFactory.GetOMCI()
' Set client_Type = omciObj.getClientType()
' clientSupport = client_Type.IsTypeSupport()
' if(clientSupport = true) Then
' warningFlag = 1
' end If
If battStatus = 25 OR battStatus = 20 OR battStatus = 30 Then
errorFlag = 1
ElseIf battStatus = 0 OR battStatus = 10 OR battStatus = 15 Then
warningFlag = 1
End If
logMessage = "Err"
MOMDebugLog 1, logMessage
End If
Next
If (errorFlag = 1) Then
BatteryHealth = "Error"
ElseIf (warningFlag = 1) then
BatteryHealth = "Warning"
Else
BatteryHealth = "OK"
End If
End Property
Public Property Let BatteryHealth(value)
m_batteryHealth = SanitizeValue(value)
End Property

End Class

Function LogErrorNumber(objName)
Dim logMessage
LogErrorNumber = Err.Number
If Err.Number &lt;&gt; 0 Then
Select Case Err.Number
Case -2147749904
logMessage = "CIM Object not found"
Case -2147749902
logMessage = "Dell CIM object not found"
Case -2147023169
logMessage = "RPC Failure occurred for namespace root-cimv2-dell"
Case -2147217389
logMessage = "Please Install/Re-Install ServerAdministrator on Dell Server!"
Case -2147217394 '0x8004100E
logMessage = "Not able to find Dell CIM object"
Case -2147217392 '0x8004100C
logMessage = "Not able to find the collection"
Case -2147749890
logMessage = "Object cannot be found"
Case -2147749892
logMessage = "Object cannot be found"
Case Else
logMessage = "Err: Unable to retrieve " &amp; objName &amp; vbCrLf &amp;_
" Error number: " &amp; Err.Number &amp; vbCrLf &amp;_
" Error description: '" &amp; Err.Description &amp; vbCrLf
End Select
MOMDebugLog 1, "ERROR: " &amp; logMessage

End If
End Function

' OMCI 7.x Creator

Class AttrNamePair
public WMIObjectName
public WMIObjectAttribute
public WMIServices
public index
End Class

Function CreateAttrNamePair(wmiService, wmiObject, wmiAttribute)
Set CreateAttrNamePair = New AttrNamePair
Set CreateAttrNamePair.WMIServices = wmiService
CreateAttrNamePair.WMIObjectName = wmiObject
CreateAttrNamePair.WMIObjectAttribute = wmiAttribute
End Function

Function CreateArrayAttrNamePair(wmiService, wmiObject, wmiAttribute, index)
Set CreateArrayAttrNamePair = New AttrNamePair
Set CreateArrayAttrNamePair.WMIServices = wmiService
CreateArrayAttrNamePair.WMIObjectName = wmiObject
CreateArrayAttrNamePair.WMIObjectAttribute = wmiAttribute
CreateArrayAttrNamePair.index = index
End Function

Class OMCI7x
private healthComputerObj, wbemServices, cmiV2WbemServices
private m_version
Public Default Function Init(version)
m_version = version
Set Init = Me
End Function

public Function getHealthComputer()

Dim strComputer : strComputer = "."
Err.Clear
Set wbemServices = GetObject("winmgmts:" &amp; "{impersonationLevel=impersonate}!\\" &amp; strComputer &amp; "\root\dellomci")
LogErrorNumber("root\dellomci")
logMessage = "getHealthComputer "
MOMDebugLog 1, logMessage
Dim pairs(1), i
i = -1
i = i + 1: Set pairs(i) = CreateAttrNamePair(wbemServices, "Dell_Battery", "Status")

If IsEmpty(wbemServices) Then
logMessage = "Unable to open WMI Namespace root-dellomci. Check to see if the WMI service is enabled and running, and ensure this WMI namespace exists."
MOMDebugLog 1, logMessage
Else
Set healthComputerObj = (new HealthComputer)(pairs, m_version)
Set getHealthComputer = healthComputerObj
End If
End Function
End Class

Class Fetcher
private m_healthComputerObj
Public Default Function Init( healthComputerObj)
m_healthComputerObj = healthComputerObj
Set Init = Me
End Function

Function GetAttribute(ByRef objItem, AttributeName)
If not objItem is nothing Then
Dim STR, arrayAttr
logMessage = "AttributeName " &amp; AttributeName
MOMDebugLog 1, logMessage
GetAttribute = objItem.Properties_.Item("" &amp; AttributeName)
If IsNull(GetAttribute) Then
logMessage = AttributeName &amp; " value is null"
MOMDebugLog 1, logMessage

ElseIf Len(GetAttribute) &lt;= 0 Then
logMessage = AttributeName &amp; " value is empty"
MOMDebugLog 1, logMessage
End If
logMessage = "Returning: " &amp; AttributeName &amp; " = " &amp; GetAttribute
MOMDebugLog 1, logMessage
'logMessage = "" &amp; AttributeName &amp; " " &amp; GetAttribute
End If
end function

public Function GetScalarAttribute(wbemServices, wmiobjectname, wmiattributename)
logMessage = "GetScalarAttribute Called"
MOMDebugLog 1, logMessage
On Error Resume Next
GetScalarAttribute = "Not Available"
Dim wbemObjectSet

Set wbemObjectSet = wbemServices.ExecQuery("Select * from " + wmiobjectname)
If (wbemObjectSet is Nothing) Or (isNull(wbemObjectSet)) Then
logMessage = "Unable to retrieve System Summary information"
MOMDebugLog 1, logMessage
Else
logMessage = "object retrieved successfully "
MOMDebugLog 1, logMessage
End if
logMessage = "C1 "
MOMDebugLog 1, logMessage
Dim numberOfInstances, i
numberOfInstances = wbemObjectSet.Count

Redim attributeValueList(numberOfInstances - 1)
i=0
logMessage = "C2 " &amp; numberOfInstances
MOMDebugLog 1, logMessage
On Error Resume Next
Err.Clear
Dim wbemObject
Dim val

For Each wbemObject in wbemObjectSet
logMessage = "C3 "
MOMDebugLog 1, logMessage
If Err.Number &lt;&gt; 0 Then
logMessage = "Invalid Object found"
MOMDebugLog 1, logMessage
ElseIf not wbemObject is nothing Then
val = GetAttribute(wbemObject, wmiattributename)
attributeValueList(i) = val

logMessage = "::attributeValueList = " &amp; i &amp; " " &amp; val
MOMDebugLog 1, logMessage
i = i+1
End If
Next

If (numberOfInstances = 0) then
attributeValueList(0) = "Not Available"

logMessage = "Setting Not Available as numberOfInstances is " &amp; numberOfInstances
MOMDebugLog 1, logMessage
End If
logMessage = "Setting correctly as numberOfInstances " &amp; numberOfInstances
MOMDebugLog 1, logMessage
GetScalarAttribute = attributeValueList

End Function


Public Function GetHealthStatus(ByRef component)
logMessage ="GetHealthStatus fetched"
MOMDebugLog 1, logMessage
GetHealthStatus = GetScalarAttribute(component.WMIServices, component.WMIObjectName,component.WMIObjectAttribute)
End Function

Public Function GetClientName(ByRef component)
logMessage ="GetClientName fetched"
MOMDebugLog 1, logMessage
GetClientName = GetScalarAttribute(component.WMIServices, component.WMIObjectName,component.WMIObjectAttribute)
End Function

End Class

' OMCI Factory
Class OMCIFactory
private m_omciObj
Private m_omciVersion

public Property Get OMCIVersion
OMCIVersion = m_omciVersion
End Property
Public Property Let OMCIVersion(value)
m_omciVersion = SanitizeValue(value)
End Property
Public Function ReadReg(RegPath)
On Error Resume Next

Dim objRegistry, Key
Set objRegistry = CreateObject("Wscript.shell")
Key = objRegistry.RegRead(RegPath)

ReadReg = Key
End Function

Public Function GetOMCI

On Error Resume Next
logMessage = "Determining OMCI / Dell Command | Monitor version ..."
MOMDebugLog 1, logMessage
Dim objItem, OMCIVersion, wbemServices, wbemObjectSet

Set wbemServices = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\dellomci")



If IsEmpty(wbemServices) Then 'If root-dellomci not present go for registery to fetch OMCI version
logmessage = "Unable to open WMI Namespace root-dellomci."
MOMDebugLog 1, logMessage
logmessage = "Reading Registery for OMCI / Dell Command | Monitor version"
MOMDebugLog 1, logMessage

m_omciVersion = ReadReg("HKLM\Software\Dell Computer Corporation\OpenManage\Applications\Client\Version")
'Error checking

Else

Set wbemObjectSet = wbemServices.ExecQuery("Select * from Dell_SystemManagementSoftware")
If (wbemObjectSet is Nothing) Or (isNull(wbemObjectSet)) Then

logmessage = "Unable to retrieve System Summary information"
MOMDebugLog 1, logMessage
Else

For Each objItem in wbemObjectSet
'Error checking
If Err.Number &lt;&gt; 0 Then
logmessage = "Number:" &amp; Err.Number &amp; "Description:" &amp; Err.Description
MOMDebugLog 1, logMessage
End If
'Object Retrieval
If not objItem is nothing Then
m_omciVersion = objItem.Version
Else
logmessage = "Object is Nothing"
MOMDebugLog 1, logMessage

End If
Next
End If
End If
Set wbemServices = Nothing
if IsNull(m_omciObj) or (m_omciObj Is Nothing) Then
Dim b, versionNum
b = split(m_omciVersion, ".")
versionNum = b(0)
If (versionNum &gt; 7) Then
logMessage = "OMCI / Dell Command | Monitor Version is above 7: " &amp; m_omciVersion
MOMDebugLog 1, logMessage
Set m_omciObj = (New OMCI8x)(m_omciVersion)
ElseIf (versionNum = 7) Then
logMessage = "OMCI / Dell Command | Monitor Version is unmanaged: " &amp; m_omciVersion
MOMDebugLog 1, logMessage
Set m_omciObj = (New OMCI7x)(m_omciVersion)
Else
logMessage = "Err: Dell OMCI / Dell Command | Monitor Not Installed or its older version: Not Supported Client"
MOMDebugLog 1, logMessage
End If
Else
logMessage = "Reusing OMCI / Dell Command | Monitor object"
MOMDebugLog 1, logMessage
End If
Set GetOMCI = m_omciObj
End Function

Private Sub Class_Initialize
Set m_omciObj = Nothing
End Sub

End Class

' OMCI 8.x Creator
Class OMCI8x
private healthComputerObj, wbemServices, cmiV2WbemServices
private m_version
Public Default Function Init(version)
m_version = version
Set Init = Me
End Function

public Function getClientType()
Dim strComputer : strComputer = "."
Dim clientTypeObj
Err.Clear
Set wbemServices = GetObject("winmgmts:" &amp; "{impersonationLevel=impersonate}!\\" &amp; strComputer &amp; "\root\DCIM\SYSMAN")
LogErrorNumber("root\dellomci")
logMessage = "getClientType "
MOMDebugLog 1, logMessage
Dim pairs(1), i
i = -1
i = i + 1: Set pairs(i) = CreateAttrNamePair(wbemServices, "DCIM_ComputerSystem", "Name")

If IsEmpty(wbemServices) Then
logMessage = "Unable to open WMI Namespace root-dellomci. Check to see if the WMI service is enabled and running, and ensure this WMI namespace exists."
MOMDebugLog 1, logMessage
Else
Set clientTypeObj = (new ClientType)(pairs)
Set getClientType = clientTypeObj
End If
End Function

public Function getHealthComputer()

Dim strComputer : strComputer = "."
Err.Clear
Set wbemServices = GetObject("winmgmts:" &amp; "{impersonationLevel=impersonate}!\\" &amp; strComputer &amp; "\root\DCIM\SYSMAN")
LogErrorNumber("DCIM\SYSMAN")
logMessage = "getHealthComputer"
MOMDebugLog 1, logMessage
Dim pairs(1), i
i = -1
i = i + 1: Set pairs(i) = CreateAttrNamePair(wbemServices, "DCIM_Battery", "HealthState")

If IsEmpty(wbemServices) Then
logMessage = "Unable to open WMI Namespace root-DCIM-SYSMAN. Check to see if the WMI service is enabled and running, and ensure this WMI namespace exists."
MOMDebugLog 1, logMessage
Else
Set healthComputerObj = (new HealthComputer)(pairs, m_version)
Set getHealthComputer = healthComputerObj
End If
End Function
End Class




On Error Resume Next
Dim oBag, batteryStatus, oAPI
Dim model
Dim RequiredOMCIVersion, description, health
RequiredOMCIVersion = "8.0"

'description = "Please install OMCI 8.0 or above from support.dell.com"
description = "Please install/re-install a supported version of OMCI / Dell Command | Monitor (v8.0 or later)"
Dim omciObj, iomciFactory, Componenthealth
Set iomciFactory = New OMCIFactory
if not iomciFactory is Nothing then
logMessage = "iomci factory Object Created"
MOMDebugLog 1, logMessage
Set omciObj = iomciFactory.GetOMCI()
if not omciObj is Nothing then
logMessage = " Object Created"
MOMDebugLog 1, logMessage
set health = omciObj.getHealthComputer()
batteryStatus = health.BatteryHealth
logMessage = "&lt;&gt;Battery Health :" &amp; batteryStatus
MOMDebugLog 1, logMessage
else
logMessage = " Object not created"
MOMDebugLog 1, logMessage
End if
else
logMessage = "OMCI / Dell Command | Monitor Object not created"
MOMDebugLog 1, logMessage

End if
On Error Goto 0
Set oAPI = CreateMOMScriptAPI()
set oBag = CreatePropertyBag (oAPI)
oInstAddValue oBag, "Status", batteryStatus
ReturnData oAPI, oBag

logMessage = "INFO : Script - Dell Client battery Monitoring : End()"
MOMDebugLog 1, logMessage
logMessage = "------------------------------------------------------"
MOMDebugLog 1, logMessage

' Close file used for logs
If logLevel &lt;&gt; 0 Then
objLogTextFile.Close
Set objLogTextFile = Nothing
Set objLogFSO = Nothing
End If


'********** SCOM Functions
Function CreateMOMScriptAPI
If DebugScript = False Then
Set CreateMOMScriptAPI = CreateObject("MOM.ScriptAPI")
Else
Set CreateMOMScriptAPI = New RegExp
End If
logMessage = "INFO: New MOM.ScriptAPI"
MOMDebugLog 1, logMessage
End Function

Function CreatePropertyBag(ByRef oAPI)
If DebugScript = False Then
set CreatePropertyBag = oAPI.CreatePropertyBag()
Else
Set CreatePropertyBag = New RegExp
End If
logMessage = "INFO: New Monitor Data"
MOMDebugLog 1, logMessage
End Function

Sub ReturnData (ByRef oAPI, ByRef oBag)
If DebugScript = False Then
Call oAPI.Return(oBag)
End If
logMessage = "INFO: Returning Monitor Data"
MOMDebugLog 1, logMessage
End Sub

Sub oInstAddValue(ByRef oBag, prop, val)
If DebugScript = False Then
Call oBag.AddValue(prop, val)
End If
logMessage = "INFO: Set " &amp; prop &amp; " = " &amp; val
MOMDebugLog 1, logMessage
End Sub

Function CreateClassInstance(ByRef oDiscoveryData, ByRef classid)
If DebugScript = False Then
set CreateClassInstance = oDiscoveryData.CreateClassInstance(classid)
Else
Set CreateClassInstance = New RegExp
End If
logMessage = "INFO: New Class Instance" &amp; classid
MOMDebugLog 1, logMessage
End Function

Sub AddInstanceToDiscoveryData(ByRef oDiscoveryData, ByRef oInst)
If DebugScript = False Then
Call oDiscoveryData.AddInstance(oInst)
End If
logMessage = "INFO: AddInstance to Discovery Data"
MOMDebugLog 1, logMessage
End Sub


Function DebugOut(message)
If DebugScript Then WScript.Echo message

End Function

</Script></ScriptBody>
<TimeoutSeconds>300</TimeoutSeconds>
<ErrorExpression>
<SimpleExpression>
<ValueExpression>
<XPathQuery>Property[@Name='Status']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">Error</Value>
</ValueExpression>
</SimpleExpression>
</ErrorExpression>
<WarningExpression>
<SimpleExpression>
<ValueExpression>
<XPathQuery>Property[@Name='Status']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">Warning</Value>
</ValueExpression>
</SimpleExpression>
</WarningExpression>
<SuccessExpression>
<SimpleExpression>
<ValueExpression>
<XPathQuery>Property[@Name='Status']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">OK</Value>
</ValueExpression>
</SimpleExpression>
</SuccessExpression>
</Configuration>
</UnitMonitor>