Lenovo HwComponentsGroup1 Discovery Provider

IBM.HwComponentsGroup1.DiscoveryProvider (DataSourceModuleType)

Element properties:

TypeDataSourceModuleType
IsolationAny
AccessibilityInternal
RunAsDefault
OutputTypeSystem.Discovery.Data

Member Modules:

ID Module Type TypeId RunAs 
DS DataSource IBM.WinComputer.DiscoveryBase.Repository Default

Overrideable Parameters:

IDParameterTypeSelectorDisplay NameDescription
IntervalSecondsint$Config/IntervalSeconds$Lenovo HwComponentsGroup1 Discovery Provider Interval Seconds
TimeoutSecondsint$Config/TimeoutSeconds$Lenovo HwComponentsGroup1 Discovery Provider Timeout Seconds

Source Code:

<DataSourceModuleType ID="IBM.HwComponentsGroup1.DiscoveryProvider" Accessibility="Internal">
<Configuration>
<xsd:element name="IntervalSeconds" type="xsd:integer"/>
<xsd:element name="TimeoutSeconds" type="xsd:integer"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalSeconds" ParameterType="int" Selector="$Config/IntervalSeconds$"/>
<OverrideableParameter ID="TimeoutSeconds" ParameterType="int" Selector="$Config/TimeoutSeconds$"/>
</OverrideableParameters>
<ModuleImplementation>
<Composite>
<MemberModules>
<DataSource ID="DS" TypeID="IBM.WinComputer.DiscoveryBase.Repository">
<IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
<SyncTime/>
<ScriptName>IBMHwComponentsGroup1Discovery.vbs</ScriptName>
<Arguments>"$MPElement$" "$Target/Id$" "$Target/ManagementGroup/Name$" "$Target/Property[Type="IBM.SystemX.BaseSystem"]/HostPrincipalName$" "$Target/Property[Type="IBM.SystemX.BaseSystem"]/SystemUUID$" "$Target/Property[Type="IBM.SystemX.BaseSystem"]/HostPlatformAgentInfo$" "$Target/Host/Property[Type="IBM.SystemX.Platform"]/Licensed$"</Arguments>
<ScriptBody><Script>
' For MEM, NIC, ServeRAID, LSI IR, Storage Device and Management Controllers discovering
'

'InstanceID of Director 6.1.2
'CPU 1f501f4601f201f450
'Physical Memory 2f2801f4601f201f45
'Fan 10 Tach:6f2901f450
'BMC or IMM
'00-14-5E-5A-E2-BC(P-NetWork)(00:14:5E:5A:E2:BE description:BMC Network Port)
'PS 1 Status:3f3201f201f450(PowerSupply)
'CPU1 Vcore:5f2a01f450(Voltage)
'Planar 3.3V:2f2a01f450(Voltage)
'Ambient Temp:2f2b01f450(Temperature)
'CPU 1 Temp:4f2b01f501f4601f201f45(Temperature)
'
'Instance name for hw components of unlicensed system
'
'Const IMM_INSTANCE_NAME = "BMC or IMM"
'Const MEMORY_INSTANCE_NAME = "Physical Memory"
'Const SR_INSTANCE_NAME = "ServeRAID"
'Const MR_INSTANCE_NAME = "ServeRAID-MR"
'Const IR_INSTANCE_NAME = "LSI Integrated RAID"


'for the event match, just use the AlertingManagedElement to match the keywords, such as "Network" or "Fan" or "Tachometer"
'4/19/2010 9:43:52 PM
' AlertingManagedElement :\\KKR004\root\ibmsd:IBMPSG_PhysicalNetworkAdapter.CreationClassName="IBMPSG_PhysicalNetworkAdapter",Tag="00-14-5E-5A-E2-BA"
' Description :NIC is Online
' EventID :NetworkPort:IP ConfigurationOnline
' PerceivedSeverity :2
' AlertingElementFormat :2
' AlertType :3
' EventTime :20100419214352.000000+480
' Message :NIC is Online
' MessageID :10816
' OtherAlertingElementF...:
' OtherAlertType :
' OtherSeverity :
' ProbableCause :1
' ProbableCauseDescription:
' ProviderName :NetworkAdapterProvider
'
'4/19/2010 10:39:51 PM
' AlertingManagedElement :\\KKR004\root\ibmsd:IBMPSG_Tachometer.CreationClassName="IBMPSG_Tachometer",DeviceID="Fan 10 Tach:6f2901f450",SystemCreationClassName="IBMPSG_ComputerSystem",SystemName="KKR004"
' Description :Fan 10 Tach fell below threshold of 750 RPM. The current value is 5100 RPM.
' EventID :Fan 10 Tach : CriticalLow
' PerceivedSeverity :4
' AlertingElementFormat :2
' AlertType :3
' EventTime :20100419223951.000000+480
' Message :Fan 10 Tach fell below threshold of 750 RPM. The current value is 5100 RPM.
' MessageID :10305
' OtherAlertingElementF...:
' OtherAlertType :
' OtherSeverity :
' ProbableCause :1
' ProbableCauseDescription:
' ProviderName :SensorProvider

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

'Getting Parameters from MP
Dim sourceID, managedEntityID, managementGroupName, systemUUID, platformPrincipalName, agentVersion, hwLicense

sourceID = oArgs(0)
managedEntityID = oArgs(1)
managementGroupName = oArgs(2)
platformPrincipalName = oArgs(3)
systemUUID = oArgs(4)
agentVersion = oArgs(5)
hwLicense = oArgs(6)

EventID = 105

Call HwComponentsGroup1Discovery()

'All Hardware System Discovery
Sub HwComponentsGroup1Discovery()

Dim oBag

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


Call LogDebugString("Entering HwComponentsGroup1Discovery..." +vbCrlf+ _
" sourceID:'" + CStr(sourceID) + "'" +vbCrlf+ _
" mgdEntityID:'" + CStr(managedEntityID) + "'" +vbCrlf+ _
" mgmtGroup:'" + CStr(managementGroupName) + "'" +vbCrlf+ _
" platformPrin..Name:'" + CStr(platformPrincipalName)+ "'" +vbCrlf+ _
" systemUUID:'" + CStr(systemUUID) + "'" +vbCrlf+ _
" agentVersion:'" + CStr(agentVersion) + "'" +vbCrlf+ _
" hwLicense:'" + CStr(hwLicense) + "'" , INFO_LEVEL_DETAIL)

Set oDiscoveryData = oAPI.CreateDiscoveryData(0, sourceID, managedEntityID)
'On error resume next
If (CreateAllHwComponentsGroup1() &gt; 0) Then
Call LogDebugString("Created Management Target", INFO_LEVEL)
End If

Call oAPI.Return(oDiscoveryData)

End Sub


'===========================================================================================
' Base Hardware Components
'===========================================================================================

'Create Instances for All Base Hardware Components
Function CreateAllHwComponentsGroup1()

Call LogDebugString("Entering CreateAllHwComponentsGroup1", INFO_LEVEL_FUNCTION)

CreateAllHwComponentsGroup1 = -1

Call CreateAllPhysicalMemoryInstances()
Call CreateAllNetworkDeviceInstances()
Call CreateTheAllServeRAIDDeviceInstance()
Call CreateTheAllIntegratedRAIDDeviceInstance()
Call CreateTheAllMegaRAIDDeviceInstance()
Call CreateTheAllStorageDeviceInstance()
Call CreateAllMgmtControllerInstances()

CreateAllHwComponentsGroup1 = 1
End Function

'Bind Hoster Key Property
Function BindHosterKeyProperty( ByVal oHWComponentInstance )
Call LogDebugString("Entering BindHosterKeyProperty", INFO_LEVEL_FUNCTION)
Dim oPropertyValue
oPropertyValue = CStr(platformPrincipalName)
Call oHWComponentInstance.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", oPropertyValue)

oPropertyValue = CStr(platformPrincipalName)
Call oHWComponentInstance.AddProperty("$MPElement[Name='IBM.SystemX.Platform']/HostPrincipalName$", oPropertyValue)
Call oHWComponentInstance.AddProperty("$MPElement[Name='IBM.SystemX.BaseSystem']/HostPrincipalName$", oPropertyValue)


End Function

'=========================== Create Instances for All Physical Memory =========================

Function CreateAllPhysicalMemoryInstances()
Call LogDebugString("Entering CreateAllPhysicalMemoryInstances", INFO_LEVEL_FUNCTION)
Dim oObjectItem, oPMTargetCollection, iResult
CreateAllPhysicalMemoryInstances = -1

'Getting Physical Memory's instance
iResult = GetWMIObjectCollection(IBMSD_NAMESPACE, PHYSICAL_MEMORY_IBMSD_CLASS, oPMTargetCollection)
'If (iResult &gt; 0) and (hwLicense &lt;&gt; "None") Then
If (iResult &gt; 0) Then
'for fee
For Each oObjectItem in oPMTargetCollection
CreateOnePhysicalMemoryInstance(oObjectItem)
Next
'ElseIf (iResult &gt; 0) and (hwLicense = "None") Then
' call CreateNonLicensedMemoryInst()
Else
Call LogDebugString("Can not get Physical Memory collection instance", WARNING_LEVEL)
End If

CreateAllPhysicalMemoryInstances = 1
End Function

Function CreateOnePhysicalMemoryInstance(ByVal oObjectItem)
Call LogDebugString("Entering CreateOnePhysicalMemoryInstance", INFO_LEVEL_FUNCTION)
CreateOnePhysicalMemoryInstance = -1
Dim oPMTargetInstance
Set oPMTargetInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.PhysicalMemory']$")

Call UpdatePhysicalMemoryProperty(oPMTargetInstance, oObjectItem)

Call BindHosterKeyProperty(oPMTargetInstance)

Call LogDebugString("Created a physical memory instance; adding to discovery data", INFO_LEVEL_DETAIL)
Call oDiscoveryData.AddInstance(oPMTargetInstance)

CreateOnePhysicalMemoryInstance = 1
End Function

Function UpdatePhysicalMemoryProperty(ByRef oPMInstance, ByVal oObjectItem)
Call LogDebugString("Entering UpdatePhysicalMemoryProperty", INFO_LEVEL_FUNCTION)
Dim oTag, sBankLabel, oPropertyValue
oTag = "Unknown"
sBankLabel = "Unknown"

ON ERROR RESUME NEXT ' Skip errors below, some of which may not always exist
oTag = oObjectItem.Tag
sBankLabel = CStr(oObjectItem.BankLabel)
ON ERROR GOTO 0 ' Break on errors here on.
Call oPMInstance.AddProperty("$MPElement[Name='IBM.SystemX.HWComponent']/InstanceID$", oTag)
Call oPMInstance.AddProperty("$MPElement[Name='IBM.SystemX.PhysicalMemory']/SlotLocation$", sBankLabel)

End Function

Function CreateNonLicensedMemoryInst()
Call LogDebugString("Entering CreateNonLicensedMemoryInst", INFO_LEVEL_FUNCTION)
CreateNonLicensedMemoryInst = -1
Dim oPMInstance
Set oPMInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.PhysicalMemory']$")


Call oPMInstance.AddProperty("$MPElement[Name='IBM.SystemX.HWComponent']/InstanceID$", MEMORY_INSTANCE_NAME)
Call oPMInstance.AddProperty("$MPElement[Name='IBM.SystemX.PhysicalMemory']/SlotLocation$", NA)


Call BindHosterKeyProperty(oPMInstance)

Call LogDebugString("Created a physical memory instance; adding to discovery data", INFO_LEVEL_DETAIL)
Call oDiscoveryData.AddInstance(oPMInstance)
CreateNonLicensedMemoryInst = 1
End Function
'=========================== Create Instances for All Network Device =========================

Function CreateAllNetworkDeviceInstances()
Call LogDebugString("Entering CreateAllNetworkDeviceInstances", INFO_LEVEL_FUNCTION)
Dim oObjectItem, oNICTargetCollection, iResult
CreateAllNetworkDeviceInstances = -1

'Getting NIC's instance
'iResult = GetWMIObjectCollection(IBMSD_NAMESPACE, NETWORK_ADAPTER_IBMSD_CLASS, oNICTargetCollection)
iResult = GetWMIObjectCollection(IBMSE_NAMESPACE, NETWORK_ADAPTER_IBMSE_CLASS, oNICTargetCollection)
'If (iResult &gt; 0) and (hwLicense &lt;&gt; "None") Then
If (iResult &gt; 0) Then
For Each oObjectItem in oNICTargetCollection
CreateNIC(oObjectItem)
Next
'ElseIf (iResult &gt; 0) and (hwLicense = "None") Then
' Call CreateNonLicensedNIC()
Else
Call LogDebugString("Can not get NIC collection instance", WARNING_LEVEL)
End If

CreateAllNetworkDeviceInstances = 1
End Function

Function CreateNIC(ByVal oObjectItem)
Call LogDebugString("Entering CreateNIC", INFO_LEVEL_FUNCTION)
CreateNIC = -1

Dim oNICTargetInstance, oHWSystemHostsMTargetRelation, oPropertyValue
Set oNICTargetInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.NetworkDevice']$")

Call UpdateNICProperty(oNICTargetInstance, oObjectItem)
Call BindHosterKeyProperty(oNICTargetInstance)

Call LogDebugString("Created a network device instance; adding to discovery data", INFO_LEVEL)
Call oDiscoveryData.AddInstance(oNICTargetInstance)

CreateNIC = 1
End Function

Function UpdateNICProperty(ByRef oNICInstance, ByVal oObjectItem)
Call LogDebugString("Entering UpdateNICProperty", INFO_LEVEL_FUNCTION)
Dim oInstanceID, oManufacturer, oDescription, oStatus,oName

oInstanceID = CStr(oObjectItem.Tag)

oManufacturer = "Unknown"
oDescription = "Unknown"
oStatus = "Unknown"
oName = "Unknown"

ON ERROR RESUME NEXT ' Skip errors below, some of which may not always exist
oManufacturer = CStr(oObjectItem.Manufacturer)
oDescription = CStr(oObjectItem.Name)
oStatus = CStr(oObjectItem.Status)
If(IsRegExpMatched(agentVersion, "^5\.")) Then
oName = oDescription
Else
'Director 6.1.1 and later: what's different here??? isn't it all ended up with the value of oObjectItem.Name???
'oName = ChangeString(CStr(oObjectItem.Name))
oName = CStr(oObjectItem.Name)
End If

ON ERROR GOTO 0 ' Break on errors here on.

Call oNICInstance.AddProperty("$MPElement[Name='IBM.SystemX.HWComponent']/InstanceID$", oInstanceID)
Call oNICInstance.AddProperty("$MPElement[Name='IBM.SystemX.NetworkDevice']/Manufacturer$", oManufacturer)
Call oNICInstance.AddProperty("$MPElement[Name='IBM.SystemX.NetworkDevice']/Description$", oDescription)
Call oNICInstance.AddProperty("$MPElement[Name='IBM.SystemX.NetworkDevice']/Status$", oStatus)
Call oNICInstance.AddProperty("$MPElement[Name='IBM.SystemX.NetworkDevice']/NetworkName$", oName)

End Function

Function CreateNonLicensedNIC()
Call LogDebugString("Entering CreateNonLicensedNIC", INFO_LEVEL_FUNCTION)
CreateNonLicensedNIC = -1

Dim oNICTargetInstance, oHWSystemHostsMTargetRelation, oPropertyValue
Set oNICTargetInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.NetworkDevice']$")

'Call UpdateNICProperty(oNICTargetInstance, oObjectItem)
Call oNICTargetInstance.AddProperty("$MPElement[Name='IBM.SystemX.HWComponent']/InstanceID$", NETWORK_INSTANCE_NAME)
Call oNICTargetInstance.AddProperty("$MPElement[Name='IBM.SystemX.NetworkDevice']/Manufacturer$", NA)
Call oNICTargetInstance.AddProperty("$MPElement[Name='IBM.SystemX.NetworkDevice']/Description$", NA)
Call oNICTargetInstance.AddProperty("$MPElement[Name='IBM.SystemX.NetworkDevice']/Status$", NA)
Call oNICTargetInstance.AddProperty("$MPElement[Name='IBM.SystemX.NetworkDevice']/NetworkName$", NA)
Call BindHosterKeyProperty(oNICTargetInstance)

Call LogDebugString("Created NonLicensed network device instance; adding to discovery data", INFO_LEVEL)
Call oDiscoveryData.AddInstance(oNICTargetInstance)

CreateNonLicensedNIC = 1
End Function

'=========================== Create THE All ServeRAID Device Instance =========================
Function CreateTheAllServeRAIDDeviceInstance()
Call LogDebugString("Entering CreateTheAllServeRAIDDeviceInstance (Adaptec)", INFO_LEVEL_FUNCTION)
Dim oObjectItem, oServeRAIDDeviceCollection, iResult, oServeRAIDInstance, oPropertyValue
CreateTheAllServeRAIDDeviceInstance = -1

'Getting ServeRAID's instance in root/adpt
If (IsRegExpMatched(agentVersion, "^5\.1")) Then
'Director Core Service 5.10.x
iResult = GetWMIObjectCollection("root/ibmsd", "IBMPSG_ServeRAIDController", oServeRAIDDeviceCollection)
'If (iResult &gt; 0) and (hwLicense &lt;&gt; "None") Then
If (iResult &gt; 0) Then
'Got the ServeRAID Controller's instances
For Each oObjectItem in oServeRAIDDeviceCollection
Set oServeRAIDInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.ServeRAIDDevice.For.DirectorAgent.5.1x']$")
Call UpdateServeRAIDProperty(oServeRAIDInstance, oObjectItem, agentVersion)
Call BindHosterKeyProperty(oServeRAIDInstance)
Call LogDebugString("Created the ServeRAID Device instance (Adaptec)", INFO_LEVEL)
Call oDiscoveryData.AddInstance(oServeRAIDInstance)
Exit For
Next
'ElseIf (iResult &gt; 0) and (hwLicense = "None") Then
' call CreateNonLicensedServeRAID(1)

End If
Else
'Director Core Service 5.20.x and 6.2 (not 6.1.x) support Adaptec ServeRAID; and presuming the support will continue post 6.2.
If (IsRegExpMatched(agentVersion, "^6\.1")) Then
'Director 6.1.1 nor 6.1.2 do not support ServeRAID; but 6.2 does (and assuming post 6.2 does, too).
Call LogDebugString("Adaptec ServeRAID is not supported by Director 6.1.x", WARNING_LEVEL)
End If
iResult = GetWMIObjectCollection("root/adpt", "ADPT_ControllerProduct", oServeRAIDDeviceCollection)
'If (iResult &gt; 0) and (hwLicense &lt;&gt; "None") Then
If (iResult &gt; 0) Then
'Got the ServeRAID Controller's instances
For Each oObjectItem in oServeRAIDDeviceCollection
Set oServeRAIDInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.ServeRAIDDevice.For.DirectorAgent.5.2x']$")
Call UpdateServeRAIDProperty(oServeRAIDInstance, oObjectItem, agentVersion)
Call BindHosterKeyProperty(oServeRAIDInstance)
Call LogDebugString("Created the ServeRAID Device instance (Adaptec)", INFO_LEVEL_DETAIL)
Call oDiscoveryData.AddInstance(oServeRAIDInstance)
Exit For ' [d504104/byou: Need only one for all]
Next
'ElseIf (iResult &gt; 0) and (hwLicense = "None") Then
' Call CreateNonLicensedServeRAID(2)
End If
End If
CreateTheAllServeRAIDDeviceInstance = 1
End Function

Function UpdateServeRAIDProperty(ByRef oServeRAIDInstance, ByVal oObjectItem, ByVal agentVersion)
Call LogDebugString("Entering UpdateServeRAIDProperty", INFO_LEVEL_FUNCTION)
Dim oElementName, oVendor
'[lin for 2.4, it's ok to use the predetermined value, while for per-instance support, we must not do like that.
'It also need to modify for Director 5.2 and subsequent, the oObjectItem.ElementName is not a key but should be IdentifyingNumber.
'We may need add more properties for RAID classes for user for readability.]

' [d504104/byou: Use the predetermined value, since we create one and only one such.]
oElementName = "ServeRAID-8x/7x/6x Controller(s) and Disk Drive(s)"
oVendor = "Adaptec, Inc."
' -- old code --
' oElementName = "Unknown"
' oVendor = "Unknown"
' ON ERROR RESUME NEXT ' Skip errors below, some of which may not always exist
' If (IsRegExpMatched(agentVersion, "^5\.1")) Then
' 'Director Core Service 5.10.x
' oElementName = CStr(oObjectItem.Description)
' oVendor = CStr(oObjectItem.Manufacturer)
' Else
' 'For agent 5.20.x and 6.x (even though not supported with 6.1.1 nor 6.1.2)
' oElementName = CStr(oObjectItem.ElementName)
' oVendor = CStr(oObjectItem.Vendor)
' End If
' ON ERROR GOTO 0 ' Break on errors here on.
Call oServeRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.HWComponent']/InstanceID$",oElementName)
Call oServeRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.ServeRAIDDevice']/Vendor$",oVendor)
End Function

Function CreateNonLicensedServeRAID(ByVal srType)
Dim oServeRAIDInstance
CreateNonLicensedServeRAID = -1
if srType = 1 Then
Set oServeRAIDInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.ServeRAIDDevice.For.DirectorAgent.5.1x']$")
elseif srType = 2 Then
Set oServeRAIDInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.ServeRAIDDevice.For.DirectorAgent.5.2x']$")
end if
Call oServeRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.HWComponent']/InstanceID$",SR_INSTANCE_NAME)
Call oServeRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.ServeRAIDDevice']/Vendor$",NA)
Call LogDebugString("Create NonLicensed ServeRAID", INFO_LEVEL)
Call BindHosterKeyProperty(oServeRAIDInstance)

Call LogDebugString("Created a ServeRAID instance; adding to discovery data", INFO_LEVEL_DETAIL)
Call oDiscoveryData.AddInstance(oServeRAIDInstance)
CreateNonLicensedServeRAID =1
End Function
'=========================== Create Instances for All LSI IntegratedRAID Device =========================

Function CreateTheAllIntegratedRAIDDeviceInstance()
Call LogDebugString("Entering CreateTheAllIntegratedRAIDDeviceInstance", INFO_LEVEL_FUNCTION)
Dim oObjectItem, oIntegratedRAIDDeviceCollection, iResult, oIntegratedRAIDInstance, oPropertyValue,oNamespace,oIndicationClass
CreateTheAllIntegratedRAIDDeviceInstance = -1
oNamespace = ""
oIndicationClass = ""

'Getting IntegratedRAID's instance in root/LSI_IR_1_2_0
If (IsRegExpMatched(agentVersion, "^5\.1")) Then
'Director Core Service 5.10.x, not support LSI IR Device
Call LogDebugString("LSI Integrated RAID is not supported by Director 5.10.x", INFO_LEVEL)
Else
If(IsRegExpMatched(agentVersion, "^5\.2")) Then
'Director Core Service 5.20.x
iResult = GetWMIObjectCollection(LSI_NAMESPACE, RAIDCARD_LSI_CLASS, oIntegratedRAIDDeviceCollection)
oNamespace = LSI_NAMESPACE
oIndicationClass = "CIM_AlertIndication"
Else
'Director Core Service 6.1.x
'LSIESG_IntegratedRaidChip.CreationClassName="LSIESG_IntegratedRaidChip",Tag="500605b00115f890"
'LSIESG_IntegratedRaidProduct.IdentifyingNumber="500605b00115f890",Name="SR-BR10i",Vendor="LSIESG",Version="Not Available"
iResult = GetWMIObjectCollection("root/LSI_MR_1_3_0", "LSIESG_IntegratedRaidProduct", oIntegratedRAIDDeviceCollection)
oNamespace = "root/LSI_MR_1_3_0"
oIndicationClass = "CIM_AlertIndication"
End If
'If (iResult &gt; 0) and (hwLicense &lt;&gt; "None") Then
If (iResult &gt; 0) Then
'Got the IntegratedRAID Controller's instances
For Each oObjectItem in oIntegratedRAIDDeviceCollection
Set oIntegratedRAIDInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.LSI.IntegratedRAIDDevice']$")
Call UpdateIntegratedRAIDProperty(oIntegratedRAIDInstance, oObjectItem,oNamespace,oIndicationClass)
Call BindHosterKeyProperty(oIntegratedRAIDInstance)
Call LogDebugString("Created a IntegratedRAID Device instance", INFO_LEVEL_DETAIL)
Call oDiscoveryData.AddInstance(oIntegratedRAIDInstance)
Exit For
Next
'ElseIf (iResult &gt; 0) and (hwLicense = "None") Then
' Call CreateNonLicenseRAID( 1,oNamespace )
End If
End If
CreateTheAllIntegratedRAIDDeviceInstance = 1
End Function

Function UpdateIntegratedRAIDProperty(ByRef oIntegratedRAIDInstance, ByVal oObjectItem, ByVal oNamespace,ByVal oIndicationClass)
Call LogDebugString("Entering UpdateIntegratedRAIDProperty", INFO_LEVEL_FUNCTION)
Dim oElementName, oVendor
oElementName = "Unknown"
oVendor = "Unknown"

ON ERROR RESUME NEXT ' Skip errors below, some of which may not always exist
oElementName = oObjectItem.ElementName
if(isNull(oObjectItem.ElementName)) then
'Director 6.1.x
'linlin modified at 2010/9/19, the IdentifyingNumber is a key. in Director 6.2.1
'We should use the Key property value to be the instanceID, since we deside to monitor per-instance.
'And there also need add a property name to this class.
'LSIESG_IntegratedRaidProduct.IdentifyingNumber="500605b00115f890",Name="SR-BR10i",Vendor="LSIESG",Version="Not Available"
'oElementName = oObjectItem.Name
oElementName = oObjectItem.IdentifyingNumber
end if
oElementName = CStr(oElementName)
Call LogDebugString("IntegratedRAID instanceID: " + oElementName , INFO_LEVEL)
oVendor = CStr(oObjectItem.Vendor)
ON ERROR GOTO 0 ' Break on errors here on.
Call oIntegratedRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.HWComponent']/InstanceID$",oElementName)
Call oIntegratedRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.LSIRAIDDevice']/Vendor$",oVendor)
Call oIntegratedRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.LSIRAIDDevice']/ibmNameSpace$",oNamespace)
'
End Function

'=========================== Create Instances for All LSI MegaRAID Device =========================

Function CreateTheAllMegaRAIDDeviceInstance()
Call LogDebugString("Entering CreateTheAllMegaRAIDDeviceInstance", INFO_LEVEL_FUNCTION)
Dim oObjectItem, oMegaRAIDDeviceCollection, iResult, oMegaRAIDInstance, oPropertyValue,oNamespace,oIndicationClass
CreateTheAllMegaRAIDDeviceInstance = -1
oNamespace = ""
oIndicationClass = ""

'Getting MegaRAID's instance in root/LSI_MR_1_2_0
If (IsRegExpMatched(agentVersion, "^5\.1")) Then
'Director Core Service 5.10.x, not support LSI MR Device
Call LogDebugString("Lenovo ServeRAID-MR is not supported by Director 5.10.x", INFO_LEVEL)
Else
If(IsRegExpMatched(agentVersion, "^5\.2")) Then
'Director Core Service 5.20.x
iResult = GetWMIObjectCollection(LSI_MR_NAMESPACE, LSI_MEGARAIDCARD_CLASS , oMegaRAIDDeviceCollection)
oNamespace = "root/LSI_MR_1_2_0"
oIndicationClass = "CIM_AlertIndication"
Else
'Director Core Service 6.1.x and later: LSIESG_MegaRAIDProduct
iResult = GetWMIObjectCollection("root/LSI_MR_1_3_0", LSI_MEGARAIDCARD_CLASS , oMegaRAIDDeviceCollection)
oNamespace = "root/LSI_MR_1_3_0"
oIndicationClass = "CIM_AlertIndication"
End If
'If (iResult &gt; 0) and (hwLicense &lt;&gt; "None") Then
If (iResult &gt; 0) Then
'Got the MegaRAID Controller's instances
'Move out only create one instance even there are other MegaRAID Cards. While how about if there one MegaRAID 10m one 10i????
'linlin may have problem, need pay attention in other release
'only get the first one property
For Each oObjectItem in oMegaRAIDDeviceCollection
Set oMegaRAIDInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.LSI.MegaRAIDDevice']$")
Call UpdateMegaRAIDProperty(oMegaRAIDInstance, oObjectItem,oNamespace,oIndicationClass)
Call BindHosterKeyProperty(oMegaRAIDInstance)
Call LogDebugString("Created a MegaRAID Device instance", INFO_LEVEL)
Call oDiscoveryData.AddInstance(oMegaRAIDInstance)
'Exit For 'only get the first one property
Next
'ElseIf (iResult &gt; 0) and (hwLicense = "None") Then
' Call CreateNonLicenseRAID( 2 ,oNamespace)
End If
End If
CreateTheAllMegaRAIDDeviceInstance = 1
End Function

Function UpdateMegaRAIDProperty(ByRef oMegaRAIDInstance, ByVal oObjectItem,ByVal oNamespace,ByVal oIndicationClass)
Call LogDebugString("Entering UpdateMegaRAIDProperty", INFO_LEVEL_FUNCTION)
Dim oElementName, oVendor
oElementName = "Unknown"
oVendor = "Unknown"

ON ERROR RESUME NEXT ' Skip errors below, some of which may not always exist
'\\VAL-W2K3\root\lsi_mr_1_2_0:LSIESG_MegaRAIDProduct.IdentifyingNumber="5000087000580400",Name="LSIESG_MegaRAID_Product",Vendor="LSIESG",Version="2.23.0.32"
'oElementName =CStr(oObjectItem.ElementName)
oElementName = CStr(oObjectItem.IdentifyingNumber)
oVendor = CStr(oObjectItem.Vendor)
ON ERROR GOTO 0 ' Break on errors here on.
Call oMegaRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.HWComponent']/InstanceID$",oElementName)
Call oMegaRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.LSIRAIDDevice']/Vendor$",oVendor)
Call oMegaRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.LSIRAIDDevice']/ibmNameSpace$",oNamespace)

End Function

Function CreateNonLicenseRAID(ByVal rdtype,ByVal oNamespace)
Dim oServeRAIDInstance
Call LogDebugString("Entering CreateNonLicenseRAID", INFO_LEVEL_FUNCTION)
CreateNonLicenseRAID = -1
if rdtype = 1 Then
Set oServeRAIDInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.LSI.IntegratedRAIDDevice']$")
Call oServeRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.HWComponent']/InstanceID$",IR_INSTANCE_NAME)
Call oServeRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.LSIRAIDDevice']/Vendor$",NA)
Call oServeRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.LSIRAIDDevice']/ibmNameSpace$",oNamespace)
Call LogDebugString("Create NonLicensed IR", INFO_LEVEL)
elseif rdtype = 2 Then
Set oServeRAIDInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.LSI.MegaRAIDDevice']$")
Call oServeRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.HWComponent']/InstanceID$",MR_INSTANCE_NAME)
Call oServeRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.LSIRAIDDevice']/Vendor$",NA)
Call oServeRAIDInstance.AddProperty("$MPElement[Name='IBM.SystemX.LSIRAIDDevice']/ibmNameSpace$",oNamespace)
Call LogDebugString("Create NonLicensed MR", INFO_LEVEL)
end if

Call BindHosterKeyProperty(oServeRAIDInstance)
Call oDiscoveryData.AddInstance(oServeRAIDInstance)
CreateNonLicenseRAID =1
End Function
'=========================== Create THE All Storage Device Instance =========================

Function CreateTheAllStorageDeviceInstance()
Call LogDebugString("Entering CreateTheAllStorageDeviceInstance", INFO_LEVEL_FUNCTION)
CreateTheAllStorageDeviceInstance = -1
Dim oStorageTargetInstance, oPropertyValue

Set oStorageTargetInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.StorageDevice']$")

Call UpdateStorageProperty(oStorageTargetInstance)
Call BindHosterKeyProperty(oStorageTargetInstance)

Call LogDebugString("Created a storage device instance; adding to discovery data", INFO_LEVEL_DETAIL)
Call oDiscoveryData.AddInstance(oStorageTargetInstance)

CreateTheAllStorageDeviceInstance = 1
End Function

Function UpdateStorageProperty(ByRef oStorageInstance)
Call LogDebugString("Entering UpdateStorageProperty", INFO_LEVEL_FUNCTION)
Dim oPropertyValue

Call oStorageInstance.AddProperty("$MPElement[Name='IBM.SystemX.HWComponent']/InstanceID$", "Non-Specific Disk Controller(s)/Drive(s)")

End Function

'===========================Create Instances for All Management Controllers =========================

Function CreateAllMgmtControllerInstances()
Call LogDebugString("Entering CreateAllMgmtControllerInstances", INFO_LEVEL_FUNCTION)
Dim oObjectItem, oMgmtControllerCollection, iResult
Dim oMgmtControllerInstance
CreateAllMgmtControllerInstances = -1

'Getting BMC's instance
iResult = GetWMIObjectCollection(CIMV2_NAMESPACE, COMPUTER_SYSTEM_CIMV2_CLASS, oMgmtControllerCollection)
'If (iResult &gt; 0) and (hwLicense &lt;&gt; "None") Then
If (iResult &gt; 0) Then
For Each oObjectItem in oMgmtControllerCollection
' If (BMCPresented() &gt; 0) Then
CreateBMC(oObjectItem)
' End If
Next
'ElseIf (iResult &gt; 0) and (hwLicense = "None") Then

' Set oMgmtControllerInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.MgmtController']$")
' Call oMgmtControllerInstance.AddProperty("$MPElement[Name='IBM.SystemX.HWComponent']/InstanceID$", IMM_INSTANCE_NAME)
' Call oMgmtControllerInstance.AddProperty("$MPElement[Name='IBM.SystemX.MgmtController']/FirmwareVersion$", NA)
' Call BindHosterKeyProperty(oMgmtControllerInstance)
' Call LogDebugString("Created a mgmt controller (BMC or IMM) instance; adding to discovery data", INFO_LEVEL)
' Call oDiscoveryData.AddInstance(oMgmtControllerInstance)
Else
Call LogDebugString("Can not get BMC collection instance", INFO_LEVEL)
End If

'Getting RSA's instance
If (RSAPresented() &gt; 0) Then
CreateRSA()
End If

CreateAllMgmtControllerInstances = 1
End Function

'Function BMCPresented()
' Call LogDebugString("Entering BMCPresented", INFO_LEVEL)
' BMCPresented = -1
'
' Dim oObjectItem, oManagementTargetCollection, iResult
' Const BMC_ACPIINFO = "ACPI\IPI"

' iResult = GetWMIObjectCollection(CIMV2_NAMESPACE, PNPENTITY_CIMV2_CLASS, oManagementTargetCollection)
' If (iResult &gt; 0) Then
' For Each oObjectItem in oManagementTargetCollection
' If (InStr(CStr(oObjectItem.DeviceID), BMC_ACPIINFO) &lt;&gt; 0) Then
' BMCPresented = 1
' Call LogDebugString("BMC Presented", INFO_LEVEL)
' Exit Function
' End If
' Next
' End If
' Call LogDebugString("BMC not Presented", INFO_LEVEL)
'End Function

Function CreateBMC(ByVal oObjectItem)
Call LogDebugString("Entering CreateBMC", INFO_LEVEL_FUNCTION)
CreateBMC = -1
Dim oMgmtControllerInstance, oHWSystemHostsMTargetRelation, oPropertyValue

Set oMgmtControllerInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.MgmtController']$")

Call UpdateBMCProperty(oMgmtControllerInstance, oObjectItem)
Call UpdateIMMPropertyIfNotBMC(oMgmtControllerInstance)
Call BindHosterKeyProperty(oMgmtControllerInstance)

Call LogDebugString("Created a mgmt controller (BMC or IMM) instance; adding to discovery data", INFO_LEVEL_DETAIL)
Call oDiscoveryData.AddInstance(oMgmtControllerInstance)

CreateBMC = 1
End Function

Function UpdateIMMPropertyIfNotBMC( ByRef oMgmtControllerInstance)
Call LogDebugString("Entering UpdateIMMPropertyIfNotBMC", INFO_LEVEL_FUNCTION)
Dim iResult, oSWIDCollection, oObjectItem

iResult = GetWMIObjectCollection(IBMSE_NAMESPACE, IBMSD_SOFTWAREIDENTITY_CLASS, oSWIDCollection)
If (iResult &gt; 0) Then
For Each oObjectItem in oSWIDCollection
If (IsIMMFirmware(oObjectItem)) Then
Call UpdateIMMProperty(oMgmtControllerInstance, oObjectItem)
End If
Next
End If
End Function

Function IsIMMFirmware( ByVal oObjectItem)

IsIMMFirmware = 0

Dim propName

propName = oObjectItem.Name
if not isnull(propName) then
if ( propName = "IMM" or propName = "IMM2") then
Call LogDebugString("IsIMMFirmware returns true", INFO_LEVEL)
IsIMMFirmware = 1
End if
End if

End Function

Function UpdateIMMProperty(ByRef oBMCInstance, ByVal oObjectItem)
Call LogDebugString("Entering UpdateIMMProperty", INFO_LEVEL_FUNCTION)
Dim sVersionString, oOEMStringItem, iBeginPos, iCurPos, iEndPos, oPropertyValue, FirmwareVersion

iEndPos = 0

'Get Firmware Version
sVersionString = oObjectItem.VersionString
Call LogDebugString("VersionString = " + sVersionString, INFO_LEVEL)
' If not isnull(sVersionString) then
' iCurPos = InStr(sVersionString, "[[")
' Call LogDebugString("left at " + iCurPos, INFO_LEVEL)
' If iCurPos &lt;&gt; 0 Then
' iCurPos = iCurPos + 1
' iEndPos = InStr(iCurPos, sVersionString, "]]")
' Call LogDebugString("right at " + iCurPos, INFO_LEVEL)
' FirmwareVersion = Mid(sVersionString, iCurPos, iEndPos-iCurPos)
' Else
' FirmwareVersion = sVersionString
' End If
' End If

' Call LogDebugString("FirmwareVersion = " + FirmwareVersion, INFO_LEVEL)
oPropertyValue = "IMM"
Call oBMCInstance.AddProperty("$MPElement[Name='IBM.SystemX.HWComponent']/InstanceID$", oPropertyValue)
oPropertyValue =CStr(sVersionString)
Call oBMCInstance.AddProperty("$MPElement[Name='IBM.SystemX.MgmtController']/FirmwareVersion$", oPropertyValue)
Call LogDebugString("UpdateIMMProperty finished.", INFO_LEVEL_FUNCTION)

End Function

Function CreateRSA()
Call LogDebugString("Entering CreateRSA", INFO_LEVEL_FUNCTION)
Dim oMgmtControllerInstance, oHWSystemHostsMTargetRelation, oPropertyValue

Set oMgmtControllerInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.SystemX.MgmtController']$")

Call UpdateRSAProperty(oMgmtControllerInstance)
Call BindHosterKeyProperty(oMgmtControllerInstance)

Call LogDebugString("Created a mgmt controller (RSA) instance; adding to discovery data", INFO_LEVEL_DETAIL)
Call oDiscoveryData.AddInstance(oMgmtControllerInstance)
End Function

Function UpdateBMCProperty(ByRef oBMCInstance, ByVal oObjectItem)
Call LogDebugString("Entering UpdateBMCProperty", INFO_LEVEL_FUNCTION)
Dim oOEMStringArray, oOEMStringItem, iBeginPos, iCurPos, iEndPos, oPropertyValue, FirmwareVersion

iBeginPos = 0
iEndPos = 0

'Get Firmware Version
oOEMStringArray = oObjectItem.OEMStringArray
if not isnull(oOEMStringArray) then
For Each oOEMStringItem in oOEMStringArray
iBeginPos = Instr(oOEMStringItem, "IBM BaseBoard Management Controller")
If iBeginPos &lt;&gt; 0 Then
iBeginPos = iBeginPos + 1
iCurPos = Instr(iBeginPos, oOEMStringItem, "[")
If iCurPos &lt;&gt; 0 Then
iCurPos = iCurPos + 1
iEndPos = Instr(iCurPos, oOEMStringItem, "]")
FirmwareVersion = Mid(oOEMStringItem, iCurPos, iEndPos-iCurPos)
Exit For
End If
End If
Next
End if
If (not IsEmpty(FirmwareVersion)) and (not isnull(FirmwareVersion)) then
oPropertyValue = "BMC or IMM"
Call oBMCInstance.AddProperty("$MPElement[Name='IBM.SystemX.HWComponent']/InstanceID$", oPropertyValue)
Call LogDebugString("FirmwareVersion not null, = "+FirmwareVersion, INFO_LEVEL_FUNCTION)
oPropertyValue = CStr(FirmwareVersion)
Call oBMCInstance.AddProperty("$MPElement[Name='IBM.SystemX.MgmtController']/FirmwareVersion$", oPropertyValue)
Call LogDebugString("UpdateBMCProperty finished.", INFO_LEVEL_FUNCTION)
End If
End Function
Function UpdateRSAProperty(ByRef oRSAInstance)

Call LogDebugString("Entering UpdateRSAProperty", INFO_LEVEL_FUNCTION)
Dim oPropertyValue
oPropertyValue = "RSA"
Call oRSAInstance.AddProperty("$MPElement[Name='IBM.SystemX.HWComponent']/InstanceID$", oPropertyValue)
oPropertyValue = "Unknown"
Call oRSAInstance.AddProperty("$MPElement[Name='IBM.SystemX.MgmtController']/FirmwareVersion$", oPropertyValue)
oPropertyValue = CStr(systemUUID)

End Function

'=============================================================================================================



</Script></ScriptBody>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
</DataSource>
</MemberModules>
<Composition>
<Node ID="DS"/>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.Discovery.Data</OutputType>
</DataSourceModuleType>