Lenovo WinComputer DriverMissingProvider Probe

IBM.WinComputer.DriverMissingProvider.Probe (ProbeActionModuleType)

Element properties:

TypeProbeActionModuleType
IsolationAny
AccessibilityPublic
RunAsDefault
OutputTypeSystem.PropertyBagData

Member Modules:

ID Module Type TypeId RunAs 
PassThrough ProbeAction System.PassThroughProbe Default
Script ProbeAction IBM.WinComputer.PropertyBagBase.Repository Default

Source Code:

<ProbeActionModuleType ID="IBM.WinComputer.DriverMissingProvider.Probe" Accessibility="Public" Batching="false" PassThrough="false">
<Configuration>
<xsd:element name="TimeoutSeconds" type="xsd:integer"/>
</Configuration>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<ProbeAction ID="PassThrough" TypeID="System!System.PassThroughProbe"/>
<ProbeAction ID="Script" TypeID="IBM.WinComputer.PropertyBagBase.Repository">
<ScriptName>IBMWinComputerDriverMissing.vbs</ScriptName>
<Arguments>"$Target/Property[Type="IBM.WinComputer']/RAIDControllers$"</Arguments>
<ScriptBody><Script>

Dim oArgs
Set oArgs = WScript.Arguments
WScript.Echo oArgs.Count
if oArgs.Count &lt; 1 Then
'Wscript.Quit -1
End If
SetLocale("en-us")

Dim Name

Name = oArgs(0)
EventID = 113
if InStr(1,Name,"RAID",1) &gt; 0 Or InStr(1,Name,"SAS",1) &gt; 0 Then
Call GetDriverStatus()
else
Call CreateEmptyPropertyBag()
End If


Sub CreateEmptyPropertyBag()

'Set oAPI = SCOMCreateObject("MOM.ScriptAPI")

Call LogDebugString("Entering CreateEmptyPropertyBag", INFO_LEVEL_FUNCTION)
Call LogDebugString("RAID Controller Name:" + Name, INFO_LEVEL_DETAIL)

Set oBag= oAPI.CreatePropertyBag()
'Call UpdateDriverMissingState(oBag)
Call oAPI.Return(oBag)

End Sub

Sub GetDriverStatus()

Dim oReg, RC_Code
debug = -1
'Set oAPI = SCOMCreateObject("MOM.ScriptAPI")
Set oReg = GetObject("winmgmts://localhost/root/default:StdRegProv")
If (not(oReg is nothing)) Then
RC_Code = oReg.GetStringValue(HKEY_LOCAL_MACHINE, DEBUG_INFO_KEY, DEBUG_LEVEL_NAME, debug)
If ( RC_Code&lt;&gt;0) Then
debug = -1
End If
End If
Call LogDebugString("Entering GetDriverMissingStatus", INFO_LEVEL_DETAIL)
Call LogDebugString("RAID Controller Name:" + Name, INFO_LEVEL_DETAIL)

Set oBag= oAPI.CreatePropertyBag()
Call UpdateDriverMissingState(oBag)
Call oAPI.Return(oBag)

End Sub

Function UpdateDriverMissingState(ByRef oBag)
Call LogDebugString("Entering UpdateDriverMissingState", INFO_LEVEL_FUNCTION)
UpdateDriverMissingState = -1
Dim oObjectItem, oManagementTargetCollection, oSystemDriver,wql, iResult, I

iResult = GetWMIObjectCollection(CIMV2_NAMESPACE, PNPENTITY_CIMV2_CLASS, oManagementTargetCollection)
If (iResult &gt; 0) Then
For Each oObjectItem in oManagementTargetCollection

iResult = UpdateRAIDState(oBag, oObjectItem, ServeRAIDPCIInfoTable)
If (iResult = -1) Then
UpdateDriverMissingState = 1
Exit Function
End If
iResult = UpdateRAIDState(oBag, oObjectItem, MegaRAIDPCIInfoTable)
If (iResult = -1) Then
UpdateDriverMissingState = 1
Exit Function
End If
iResult = UpdateRAIDState(oBag, oObjectItem, IntegratedRAIDPCIInfoTable)
If (iResult = -1) Then
UpdateDriverMissingState = 1
Exit Function
End If
Next
'No error detected, add the healthy value to oBag
Call oBag.AddValue("State", "Healthy")
Call oBag.AddValue("State - All", "All RAID drivers are running")
End If

UpdateDriverMissingState = 1


End Function

'Only add the error state in this function
Function UpdateRAIDState(oBag, oObjectItem, RAIDInfoTable)
Call LogDebugString("Entering UpdateRAIDState", INFO_LEVEL_FUNCTION)
Dim oSystemDriver,wql, iResult, I
For I = 0 To UBound(RAIDInfoTable)
If (InStr(CStr(oObjectItem.DeviceID), RAIDInfoTable(I)(PCI_INFO)) &lt;&gt; 0) Then

wql = "SELECT __Class, AlertingManagedElement, Description, EventID, PerceivedSeverity FROM Win32_SystemDriver WHERE Name = '" + oObjectItem.Service + "'"

iResult = QueryWMIObjectCollection(CIMV2_NAMESPACE, wql, oSystemDriver)

If(iResult &gt; 0 ) Then
For Each oDriver in oSystemDriver
If( oDriver.State = "Running") Then
'No action if it is running state.
'Call oBag.AddValue(RAIDInfoTable(I)(DEVICE_NAME), "Healthy")
'Call oBag.AddValue(RAIDInfoTable(I)(DEVICE_NAME) + "--Description", CStr(oDriver.Description) + " is " + CStr(oDriver.State))
'Call LogDebugString(RAIDInfoTable(I)(DEVICE_NAME) + " Healthy", INFO_LEVEL)
Else
'Call oBag.AddValue(RAIDInfoTable(I)(DEVICE_NAME), "Error")
'Call oBag.AddValue(RAIDInfoTable(I)(DEVICE_NAME) + "--Description", oDriver.Description + " is " + oDriver.State)
'Call LogDebugString(RAIDInfoTable(I)(DEVICE_NAME) + " Error", INFO_LEVEL)
Call oBag.AddValue("State", "Error")
Call oBag.AddValue(RAIDInfoTable(I)(DEVICE_NAME) + "--Description", oDriver.Description + " is " + oDriver.State)
UpdateRAIDState = -1
Exit Function
End If

Next
End If
End If
Next
End Function

</Script></ScriptBody>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
</ProbeAction>
</MemberModules>
<Composition>
<Node ID="Script">
<Node ID="PassThrough"/>
</Node>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.PropertyBagData</OutputType>
<TriggerOnly>true</TriggerOnly>
</ProbeActionModuleType>