Lenovo Flex System Chassis Discover Module

IBM.FlexSystem.Discover.Module (DataSourceModuleType)

Element properties:

TypeDataSourceModuleType
IsolationAny
AccessibilityInternal
RunAsDefault
OutputTypeSystem.Discovery.Data

Member Modules:

ID Module Type TypeId RunAs 
DS DataSource System.Discovery.Scheduler Default
VBScript ProbeAction Microsoft.Windows.ScriptDiscoveryProbe Default

Overrideable Parameters:

IDParameterTypeSelector
IntervalSecondsint$Config/IntervalSeconds$
TimeoutSecondsstring$Config/TimeoutSeconds$Lenovo Flex System Chassis Discover Module Timeout Seconds

Source Code:

<DataSourceModuleType ID="IBM.FlexSystem.Discover.Module" Accessibility="Internal">
<Configuration>
<IncludeSchemaTypes>
<SchemaType>System!System.ExpressionEvaluatorSchema</SchemaType>
</IncludeSchemaTypes>
<xsd:element name="ipaddress" type="xsd:string"/>
<xsd:element name="CommunityString" type="xsd:string"/>
<xsd:element name="TimeoutSeconds" type="xsd:integer"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="IntervalSeconds" type="xsd:int"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="SyncTime" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="0" maxOccurs="1" name="NoOfRetries" type="xsd:unsignedInt" default="1"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="0" maxOccurs="1" name="Timeout" type="xsd:unsignedInt" default="1500"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" maxOccurs="1" name="Port" type="xsd:unsignedInt" default="161"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" maxOccurs="1" name="Version" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="0" maxOccurs="1" name="SNMPv3UserName" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="0" maxOccurs="1" name="SNMPv3EngineID" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="0" maxOccurs="1" name="SNMPv3AuthProtocol" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="0" maxOccurs="1" name="SNMPv3AuthPassword" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="0" maxOccurs="1" name="SNMPv3PrivProtocol" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="0" maxOccurs="1" name="SNMPv3PrivPassword" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="0" maxOccurs="1" name="SNMPv3ContextName" type="xsd:string"/>
<xsd:element name="Expression" type="ExpressionType"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int"/>
<OverrideableParameter ID="TimeoutSeconds" ParameterType="string" Selector="$Config/TimeoutSeconds$"/>
</OverrideableParameters>
<ModuleImplementation>
<Composite>
<MemberModules>
<DataSource ID="DS" TypeID="System!System.Discovery.Scheduler">
<Scheduler>
<SimpleReccuringSchedule>
<Interval>$Config/IntervalSeconds$</Interval>
<SyncTime>$Config/SyncTime$</SyncTime>
</SimpleReccuringSchedule>
<ExcludeDates/>
</Scheduler>
</DataSource>
<ProbeAction ID="VBScript" TypeID="Windows!Microsoft.Windows.ScriptDiscoveryProbe">
<ScriptName>IBMFlexChassisModuleDiscovery.vbs</ScriptName>
<Arguments>
"$Config/ipaddress$" "$MPElement$" "$Target/Id$" "$Config/CommunityString$" "$Config/Port$" "$Config/SNMPv3UserName$" "$Config/SNMPv3AuthProtocol$" "$Config/SNMPv3AuthPassword$" "$Config/SNMPv3PrivProtocol$" "$Config/SNMPv3PrivPassword$" "$Config/SNMPv3ContextName$" "$Config/Version$" "$Config/Timeout$" "$Config/NoOfRetries$"
</Arguments>
<ScriptBody><Script>
' Global Variants
'Debug Log Definition
SetLocale("en-us")
Const HKEY_LOCAL_MACHINE = &amp;H80000002
Const DEBUG_INFO_KEY = "SOFTWARE\Lenovo\Lenovo SCOM MP\Debug"
Const DEBUG_LEVEL_NAME = "Level"
Const ERROR_LEVEL = 1
Const WARNING_LEVEL = 2
Const WARNING_LEVEL_DEV = 3
Const INFO_LEVEL = 4
Const INFO_LEVEL_FUNCTION = 5
Const INFO_LEVEL_DETAIL = 6


Dim ipaddress, IPArray(), ChassisCount, CommunityString

Dim SCOMServer, Regdebug, bccInstalled, bladeChassis
Dim oAPI, oDiscoveryData, oInst, oRelCon, oBCInst
SCOMServer = Null
oAPI = Null
Regdebug = "-1"
bccInstalled = False


Dim SourceID, ManagedEntityId, TargetComputer

'SourceId = "$MPElement$" ' The GUID of the Discovery that launched the script.
'ManagedEntityId = "$Target/Id$" ' The GUID of the computer class targeted by the script.
'TargetComputer = oArgs(2) ' The FQDN of the computer targeted by the script.


Dim oArgs, EncodeCmtyStr
Set oArgs = WScript.Arguments
WScript.Echo oArgs.Count
If oArgs.Count &lt; 4 Then
'Wscript.Quit -1
End If
Set oAPI = CreateObject("MOM.ScriptAPI")
ipaddress = oArgs(0)
SourceId = oArgs(1)
ManagedEntityId = oArgs(2)
EncodeCmtyStr = oArgs(3)
WScript.Echo(ipaddress)
WScript.Echo(SourceId)
WScript.Echo(ManagedEntityId)

Dim port,user,auPro,auProPW,priPro,priProPW,context,version,timeout,retry
On Error Resume Next
port = oArgs(4)
user = oArgs(5)
auPro = oArgs(6)
auProPW = oArgs(7)
priPro = oArgs(8)
priProPW = oArgs(9)
context = oArgs(10)
version = oArgs(11)
timeout = oArgs(12)
retry = oArgs(13)
On Error GoTo 0

'*************************************
'The aArgs(3) "$Config/CommunityString$" is not encoded string. such as "public"
'******************************************
'EncodeCmtyStr="public"
CommunityString = oArgs(3) 'Chr2Unicode(fDecode(EncodeCmtyStr))
EncodeCmtyStr = CommunityString
WScript.Echo(CommunityString)

Call GetDebugLevel()

Dim chassisUUID
Set oDiscoveryData = oAPI.CreateDiscoveryData(0, SourceId, ManagedEntityId)
Set SCOMServer = WScript.CreateObject("IBM.SystemsManagement.SCOMHelper.SCOMServer")


Call oAPI.LogScriptEvent("IBMFlexChassisModuleDiscovery.vbs", 1100, 4, "Module Discovery begin on Flex System chassis: " + ipaddress)
'Call oAPI.LogScriptEvent("IBMBladeCenterModuleDiscovery.vbs", 1000, 4, "EncodeCommunityString: " + oArgs(3)) ' it is "public"!!!!!!!!!

Call LogDebugString("SourceId:" + SourceId + vbLf + _
"ManagedEntityId:" + ManagedEntityId + vbLf + _
"IPAddress:" + ipaddress, _
INFO_LEVEL_DETAIL)

Call SCOMServer.InitSCOMServerConnection()

Call SCOMServer.InitDiscoveryData()

Call ComponentDiscovery()

'******oDiscoveryData, each script only can return ONCE!!!!!!! *****
Call oAPI.Return(oDiscoveryData)
Call SCOMServer.CommitDiscoveryData(0)

Call oAPI.LogScriptEvent("IBMFlexChassisModuleDiscovery.vbs", 1101, 4, "Module Discovery finish on FlexChassis: " + ipaddress)

'-----------------------------------------------------------------------------
' End of Main
'-----------------------------------------------------------------------------

Sub ComponentDiscovery()
WScript.Echo("------------------------------------------------------")
Call WScript.Echo(" Lenovo Flex Chassis Components Discovery")
WScript.Echo("------------------------------------------------------")

bccInstalled = IsInstallBCCProject()
If (IsNull(ipaddress)) Then
Call LogDebugString("Error: Bad or missing ipaddress!", ERROR_LEVEL)
Else
Set bladeChassis = WScript.CreateObject("Lenovo.SystemsManagement.CMMClassLibrary.FlexChassis")

Call LogDebugString("Lenovo Flex Chassis Component Discovery Starting.", INFO_LEVEL_DETAIL)

Call FindBlades(ipaddress, bladeChassis)

WScript.Echo("-----------------------------------------")
WScript.Echo(" Finish Components Discovery")
Call LogDebugString("Successful!" + vbCrLf + "Lenovo Flex Chassis Component Discovery Running Successfully.", INFO_LEVEL_DETAIL)
End If
End Sub

Function FindBlades(ipaddress, bladeChassis)

Call WScript.Echo("Inventory For chassis " &amp; " at " &amp; ipaddress)
Call LogDebugString("Inventory For chassis " &amp; " at " &amp; ipaddress, INFO_LEVEL_FUNCTION)
Dim i
i = 0

Dim bladeModuleCount
bladeModuleCount = 0
Dim V7000Count
V7000Count = 0
Dim fsmModuleCount
fsmModuleCount = 0
Dim ioModuleCount
ioModuleCount = 0
Dim mmModuleCount
mmModuleCount = 0
Dim poweModuleCount
poweModuleCount = 0
Dim blowerModuleCount
blowerModuleCount = 0
Dim fanmuxModuleCount
fanmuxModuleCount = 0
Dim rearLEDModuleCount
rearLEDModuleCount = 0
'Dim mediaModuleCount
'mediaModuleCount = 0
Dim storageModuleCount
storageModuleCount = 0
Dim diskDriveModuleCount
diskDriveModuleCount = 0

Dim bladeModuleIndex
bladeModuleIndex = 0
Dim fsmModuleIndex
fsmModuleIndex = 0
Dim ioModuleIndex
ioModuleIndex = 0
Dim mmModuleIndex
mmModuleIndex = 0
Dim powerModuleIndex
powerModuleIndex = 0
Dim blowerModuleIndex
blowerModuleIndex = 0
Dim fanmuxModuleIndex
fanmuxModuleIndex = 0
Dim rearLEDModuleIndex
rearLEDModuleIndex = 0
Dim storageModuleIndex
storageModuleIndex = 0

'+++++++++++++++++++++++++++++++++++++++++++++++++++++

Dim init
init = -1

init = bladeChassis.InitializeSocketConnection(ipaddress, CommunityString,port,version)

Call bladeChassis.SetSnmpV3User(user,auPro,auProPW,priPro,priProPW,context,version,timeout,retry)

Call LogDebugString("init = " &amp; init, INFO_LEVEL_DETAIL)

If (init = 0) Then
Call LogDebugString("Try logging in using Default", WARNING_LEVEL)
Dim loggedin
loggedin = 0
'loggedin = bladeChassis.LoginDefault()

If (loggedin &lt;&gt; 0) Then
Call LogDebugString("Warning - Could not log in to management module using defaults, trying Userid/Password table", WARNING_LEVEL)
'loggedin = bladeChassis.LoginByTable()
End If

'Call LogDebugString("Loggedin = " &amp; loggedin, INFO_LEVEL)
If (loggedin = 0) Then
Dim retval
retval = bladeChassis.GetTopology() '-&gt;lin no get storage
If (retval = 0) Then

'Chassis Module
'Call CreateChassis(bladeChassis.GetChassisModule())'marked by lin at 2012'08'13
chassisUUID = bladeChassis.GetChassisModule().UUID

Dim bayNumber
bayNumber = 1
Dim SlotWidth
SlotWidth = 1
Dim blade
blade = Null
' Blade Modules
bladeModuleCount = bladeChassis.GetBladeModuleCount()
Dim bladesInstalled
bladesInstalled = bladeChassis.GetBladeModulesInstalled()
WScript.Echo("===========================================")
Call WScript.Echo(" MaxbladeModuleCount = " &amp; bladeModuleCount)
WScript.Echo("===========================================")
Call LogDebugString("MaxbladeModuleCount = " &amp; bladeModuleCount, INFO_LEVEL_DETAIL)

Dim num
For num = 0 To 13
Dim item
item = bladesInstalled(num)
WScript.Echo("num=" &amp; num)
If (item = True) Then
WScript.Echo("item=true,bayNumber=" &amp; bayNumber)

If (IsNull(bladeChassis.GetBladeModule(bayNumber)) Or bladeChassis.GetBladeModule(bayNumber) Is Nothing) Then

WScript.Echo("Create Blade Pseudo bayNumber=" &amp; bayNumber)
Call CreatePseudo(bayNumber,"Blade",chassisUUID ,0)
bayNumber = bayNumber + 1
WScript.Echo("CreatePseudo Current bayNumber=" &amp; bayNumber)
Else
'add here
If(IsNull(bladeChassis.GetBladeModuleOfCara(bayNumber)) Or bladeChassis.GetBladeModuleOfCara(bayNumber) Is Nothing) Then
WScript.Echo("This Blade is not CaraCara! Create Real and Common Blade baynumber=" &amp; bayNumber)
Call CreateBlade(bayNumber,bladeChassis.GetBladeModule(bayNumber))

Else
WScript.Echo("This Blade is CaraCara! Create the up node of Real Blade bayNumber=" &amp; bayNumber)
Call CreateBlade(bayNumber,bladeChassis.GetBladeModuleOfCara(bayNumber))
WScript.Echo("Create the lower node of the Slot = " &amp; bayNumber)
Call CreateBlade(bayNumber,bladeChassis.GetBladeModule(bayNumber))

WScript.Echo("blade.SlotWidth=" &amp; bladeChassis.GetBladeModule(bayNumber).SlotWidth)

End If
If (bladeChassis.GetBladeModule(bayNumber).SlotWidth &gt; 1) Then
SlotWidth = bladeChassis.GetBladeModule(bayNumber).SlotWidth
bayNumber = bayNumber + SlotWidth
num = num + SlotWidth - 1
Else
bayNumber = bayNumber + 1
End If
WScript.Echo("CreateBlade Current bayNumber=" &amp; bayNumber)
End If
Else
WScript.Echo("item=false,Create Blade Pseudo bayNumber=" &amp; bayNumber)
Call CreatePseudo(bayNumber,"Blade",chassisUUID ,0)
bayNumber = bayNumber + 1
WScript.Echo("BladeInstalled Current bayNumber=" &amp; bayNumber)
End If


WScript.Echo("bayNumber=" &amp; bayNumber)

If bayNumber &gt; bladeModuleCount Then
Exit For
End If

Next
'Storage for V7000
V7000Count = bladeChassis.GetV7000ModuleCount()
WScript.Echo("=======================================")
Call WScript.Echo(" MaxV7000ModuleCount =" &amp; V7000Count)
WScript.Echo("=======================================")
Call LogDebugString(" MaxV7000ModuleCount =" &amp; V7000Count,INFO_LEVEL_DETAIL)

For num = 1 To 4
If(IsNull(bladeChassis.GetV7000Module(num)) Or bladeChassis.GetV7000Module(num) Is Nothing ) Then
WScript.Echo("=======No V7000 available=========")
Else
Call CreateV7000(bladeChassis.GetV7000Module(num))
End If
Next

' FSM of the Compute Nodes
fsmModuleCount = bladeChassis.GetFSMModuleCount()
WScript.Echo("========================================")
Call WScript.Echo(" MaxfsmModuleCount =" &amp; fsmModuleCount)
WScript.Echo("========================================")
Call LogDebugString("MaxfsmModuleCount =" &amp; fsmModuleCount,INFO_LEVEL_DETAIL)

'there is no FSM in Flex System Chassis
'bayNumber = 1
'For num = 1 To 14
' If (IsNull(bladeChassis.GetFSMModule(bayNumber)) Or bladeChassis.GetFSMModule(bayNumber) Is Nothing ) Then
' bayNumber = bayNumber + 1
' Else
' Call CreateFSM(bayNumber,bladeChassis.GetFSMModule(bayNumber))
' bayNumber = bayNumber + 1
' End If
'Next


' IO Modules
ioModuleCount = bladeChassis.GetIOModuleCount()
Dim ioModulesInstalled
ioModulesInstalled = bladeChassis.GetIOModulesInstalled()

Call LogDebugString("ioModuleCount = " &amp; ioModuleCount, INFO_LEVEL_DETAIL)
WScript.Echo("===========================================")
Call WScript.Echo(" MaxioModuleCount = " &amp; ioModuleCount)
WScript.Echo("===========================================")

bayNumber = 0
For Each item In ioModulesInstalled
bayNumber = bayNumber + 1

If (item = True) Then
Call CreateSwitch(bayNumber,bladeChassis.GetIOModule(bayNumber))
Else
Call CreatePseudo(bayNumber,"IO",chassisUUID,0)
End If
If bayNumber &gt;= ioModuleCount Then
Exit For
End If
Next

' Management Modules 'linlin how about backup MM ?
mmModuleCount = bladeChassis.GetManagementModuleCount()
Dim mmModulesInstalled
mmModulesInstalled = bladeChassis.GetManagementModulesInstalled()

Call LogDebugString("mmModuleCount = " &amp; mmModuleCount, INFO_LEVEL)

bayNumber = 0
Call LogDebugString("MaxmmModuleCount = " &amp; mmModuleCount, INFO_LEVEL_DETAIL)
WScript.Echo("===========================================")
Call WScript.Echo(" MaxmmModuleCount = " &amp; mmModuleCount)
WScript.Echo("===========================================")

For Each item In mmModulesInstalled
bayNumber = bayNumber + 1
If (item = True) Then
Call CreateManagement( bayNumber,bladeChassis.GetManagementModule(bayNumber) )
Else
Call CreatePseudo(bayNumber,"MM",chassisUUID,0)
End If
If bayNumber &gt;= mmModuleCount Then
Exit For
End If
Next


' Power Modules
powerModuleCount = bladeChassis.GetPowerModuleCount()
Dim powerModulesInstalled
powerModulesInstalled = bladeChassis.GetPowerModulesInstalled()
Dim powerInstalledString
powerInstalledString = InstalledString(powerModuleCount, powerModulesInstalled)

Call LogDebugString("powerModuleCount = " &amp; powerModuleCount, INFO_LEVEL_DETAIL)
WScript.Echo("===========================================")
Call WScript.Echo(" MaxpowerModuleCount = " &amp; powerModuleCount)
WScript.Echo("===========================================")
bayNumber = 0

For Each item In powerModulesInstalled
bayNumber = bayNumber + 1
If (item = True) Then
Call CreatePower( bayNumber, bladeChassis.GetPowerModule(bayNumber))
Else
Call CreatePseudo(bayNumber,"Power",chassisUUID,0)
End If
If bayNumber &gt;= powerModuleCount Then
Exit For
End If
Next

' Blower Modules
blowerModuleCount = bladeChassis.GetBlowerModuleCount()
Dim blowerModulesInstalled
blowerModulesInstalled = bladeChassis.GetBlowerModulesInstalled()
Dim blowerInstalledString
blowerInstalledString = InstalledString(blowerModuleCount, blowerModulesInstalled)
Call LogDebugString("Blower module count = " &amp; blowerModuleCount, INFO_LEVEL_DETAIL)
WScript.Echo("===========================================")
Call WScript.Echo(" MaxblowerModuleCount = " &amp; blowerModuleCount)
WScript.Echo("===========================================")
bayNumber = 0

For Each item In blowerModulesInstalled
bayNumber = bayNumber + 1
If (item = True) Then
Call CreateBlower(bayNumber,bladeChassis.GetBlowerModule(bayNumber))
Else
Call CreatePseudo(bayNumber,"Blower",chassisUUID,0)
End If
If bayNumber &gt;= blowerModuleCount Then
Exit For
End If
Next


' FanMux Modules
fanmuxModuleCount = bladeChassis.GetFanMuxModuleCount()
Dim fanmuxModulesInstalled
fanmuxModulesInstalled = bladeChassis.GetFanMuxModulesInstalled()
Dim fanmuxInstalledString
fanmuxInstalledString = InstalledString(fanmuxModuleCount, fanmuxModulesInstalled)
Call LogDebugString("FanMux module count = " &amp; fanmuxModuleCount, INFO_LEVEL_DETAIL)
WScript.Echo("===========================================")
Call WScript.Echo(" MaxFanMuxModuleCount = " &amp; fanmuxModuleCount)
WScript.Echo("===========================================")
bayNumber = 0

For Each item In fanmuxModulesInstalled
bayNumber = bayNumber + 1
If (item = True) Then
Call CreateFanMux(bayNumber,bladeChassis.GetFanMuxModule(bayNumber))
Else
Call CreatePseudo(bayNumber,"FanMux",chassisUUID,0)
End If
If bayNumber &gt;= fanmuxModuleCount Then
Exit For
End If
Next


rearLEDModuleCount = bladeChassis.GetRearLEDModuleCount()
Dim rearLEDModulesInstalled
rearLEDModulesInstalled = bladeChassis.GetRearLEDModulesInstalled()
Dim rearLEDInstalledString
rearLEDInstalledString = InstalledString(rearLEDModuleCount, rearLEDModulesInstalled)
Call LogDebugString("RearLED module count = " &amp; rearLEDModuleCount, INFO_LEVEL_DETAIL)
WScript.Echo("===========================================")
Call WScript.Echo(" MaxRearLEDModuleCount = " &amp; rearLEDModuleCount)
WScript.Echo("===========================================")
bayNumber = 0

For Each item In rearLEDModulesInstalled
bayNumber = bayNumber + 1
If (item = True) Then
Call CreateRearLED(bayNumber,bladeChassis.GetRearLEDModule(bayNumber))
Else
Call CreatePseudo(bayNumber,"RearLED",chassisUUID,0)
End If
If bayNumber &gt;= rearLEDModuleCount Then
Exit For
End If
Next


'lin component key uuid-&gt; slot number, mm do not care pseudo

'lin call somefuc to get chassisproperties.
'Call SCOMServer.UpdateBladeCenterProperties(ipaddress, bladeModuleCount, ioModuleCount, mmModuleCount, powerModuleCount, blowerModuleCount, powerInstalledString, blowerInstalledString)

Else
Call LogDebugString("Error - GetTopology failed - retval = " &amp; retval, ERROR_LEVEL)
End If
Else
Call LogDebugString("Error - Could not log in to management module", ERROR_LEVEL)
End If

Call bladeChassis.CloseSocketConnection()
End If
End Function
'-----------------------------------------------------------------------------
' End of FindBlades()
'-----------------------------------------------------------------------------

'**
'* Calls CreateVPDData to get the data about the Blade.
'* Creates an instance of this JScript's Blade class with the data.
'**

'-----------------------------------------------------------------------------
' start of CreateChassis()
'-----------------------------------------------------------------------------
Function CreateChassis(chassisModule)
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.FlexSystem.Chassis']$")
Dim NA
NA = "Not Available"
Call LogDebugString("Entering CreateChassis" , INFO_LEVEL_FUNCTION)
If (IsNull(chassisModule) Or chassisModule Is Nothing) Then

Call LogDebugString("Error - Could not get information for chassisModule" , WARNING_LEVEL)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Chassis']/ChassisUUID$", NA)
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", ipaddress + "_" + NA)

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Chassis']/SerialNumber$", NA)
' Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Chassis']/Description$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Chassis']/PartNumber$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Chassis']/FRUNumber$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Chassis']/FRUSerialNumber$", NA)
Else
Call LogDebugString("Creating new chassisModule " &amp; "...", INFO_LEVEL_DETAIL)
Dim chassisID

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Chassis']/ChassisUUID$", chassisModule.UUID)
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", ipaddress + "_" + chassisModule.Name)

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Chassis']/MachineTypeModel$", chassisModule.MachineTypeModel)
'Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Chassis']/Description$", chassisModule.Description)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Chassis']/PartNumber$", chassisModule.PartNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Chassis']/FRUNumber$", chassisModule.FRUNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Chassis']/SerialNumber$", chassisModule.MachineSerialNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Chassis']/FRUSerialNumber$", chassisModule.FRUSerialNumber)

Call LogDebugString("Chassis data created", INFO_LEVEL_DETAIL)
End If

Call oDiscoveryData.AddInstance(oInst)
End Function

'-----------------------------------------------------------------------------
' start of CreateBlade()
'-----------------------------------------------------------------------------

Function CreateBlade(bayNumber, blade)
Call LogDebugString("Entering CreateBlade", INFO_LEVEL_FUNCTION)
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.FlexSystem.BladeModule']$")
Dim NA
NA = "Not Available"
Dim result
result = -1

If (IsNull(blade) Or blade Is Nothing) Then

Call LogDebugString("Error - Could not get information For blade in slot " &amp; bayNumber, WARNING_LEVEL)
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", ipaddress + "_" + NA)

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/MachineTypeModel$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/SerialNumber$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ComponentID$", "CHASSIS[1]/BLADE[" &amp; bayNumber &amp; "]")
'Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.BladeModule']/BladeExpansionCardList$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.BladeModule']/Firmware$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.BladeModule']/PowerOnState$", NA)

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/BayNumber$", "Node Bay " + CStr(bayNumber))
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ChassisUUID$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/UUID$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PrimaryMMIPAddress$", ipaddress)


Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/Description$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PartNumber$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUNumber$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUSerialNumber$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ModuleBay$", ModuleBay(bayNumber,"Blade"))
Call oInst.AddProperty("$MPElement[Name='NetworkLibrary!System.NetworkManagement.Node']/DeviceKey$", ipaddress)
Else
Call LogDebugString("Creating new Blade in slot " &amp; blade.Bay &amp; "...", INFO_LEVEL_DETAIL)
Dim bladeID
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", ipaddress + "_" + blade.Name)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/MachineTypeModel$", blade.MachineTypeModel)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/SerialNumber$", blade.MachineSerialNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ComponentID$", blade.ComponentID)
'Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.BladeModule']/BladeExpansionCardList$", blade.BladeExpansionCardList)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.BladeModule']/Firmware$", blade.Firmwares)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.BladeModule']/PowerOnState$", blade.PowerState)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/BayNumber$", "Node Bay " + CStr(bayNumber))
Dim oInst2
'this code currectly only the max of SlotWidth=2 or 4
If blade.SlotWidth &gt; 1 Then
If (blade.SlotWidth = 2) Then
'add the second instance
Set oInst2 = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.FlexSystem.BladeModule']$")
Call LogDebugString("Warning - Entering Create Blade with SlotWidth &gt;1, " &amp; bayNumber, WARNING_LEVEL_DEV)
Call oInst2.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/MachineTypeModel$", "")
Call oInst2.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/SerialNumber$", "")
Call oInst2.AddProperty("$MPElement[Name='IBM.FlexSystem.BladeModule']/Firmware$", "")
Call oInst2.AddProperty("$MPElement[Name='IBM.FlexSystem.BladeModule']/PowerOnState$", "")
Call oInst2.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ModuleBay$", ModuleBay(bayNumber + 1,"Blade"))
Call oInst2.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/BayNumber$", "Node Bay " + CStr(bayNumber + 1))
Call oInst2.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", ipaddress + "_" + "Node Bay " + CStr(bayNumber + 1) &amp; " - &lt;Part of Node Bay " &amp; CStr( bayNumber) &amp; "," &amp; CStr( bayNumber + 1) &amp; "&gt;")
Call oInst2.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/Description$", "")
Call oInst2.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ChassisUUID$", "")
Call oInst2.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/UUID$", "")
Call oInst2.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PrimaryMMIPAddress$", ipaddress)

Call oInst2.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PartNumber$", "")
Call oInst2.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUNumber$", "")
Call oInst2.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUSerialNumber$", "")

'Set relationship
Call oInst2.AddProperty("$MPElement[Name='NetworkLibrary!System.NetworkManagement.Node']/DeviceKey$", ipaddress)
Call oDiscoveryData.AddInstance(oInst2)
End If

If (blade.SlotWidth = 4) Then
'add other 3 instances
Dim i

For i = 1 To 3
Set oInst2 = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.FlexSystem.BladeModule']$")
Call LogDebugString("Warning - Entering Create Blade with SlotWidth &gt;1, " &amp; bayNumber, WARNING_LEVEL_DEV)
Call oInst2.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/MachineTypeModel$", "")
Call oInst2.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/SerialNumber$", "")
Call oInst2.AddProperty("$MPElement[Name='IBM.FlexSystem.BladeModule']/Firmware$", "")
Call oInst2.AddProperty("$MPElement[Name='IBM.FlexSystem.BladeModule']/PowerOnState$", "")
Call oInst2.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ModuleBay$", ModuleBay(bayNumber + i,"Blade"))
Call oInst2.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/BayNumber$", "Node Bay " + CStr(bayNumber + i))

Call oInst2.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", ipaddress + "_" + "Node Bay " + CStr(bayNumber + i) &amp; " - &lt;Part of Node Bay " &amp; CStr( bayNumber) &amp; "," &amp; CStr( bayNumber + 1) &amp; "," &amp; CStr( bayNumber + 2) &amp; "," &amp; CStr( bayNumber + 3) &amp; "&gt;")

Call oInst2.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/Description$", "")

Call oInst2.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ChassisUUID$", "")
Call oInst2.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/UUID$", "")
Call oInst2.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PrimaryMMIPAddress$", ipaddress)


Call oInst2.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PartNumber$", "")
Call oInst2.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUNumber$", "")
Call oInst2.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUSerialNumber$", "")

'Set relationship
Call oInst2.AddProperty("$MPElement[Name='NetworkLibrary!System.NetworkManagement.Node']/DeviceKey$", ipaddress)
Call oDiscoveryData.AddInstance(oInst2)
Next
End If
Else
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/BayNumber$", "Node Bay " + blade.Bay)
End If

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ChassisUUID$", blade.ChassisUUID)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/UUID$", blade.UUID)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PrimaryMMIPAddress$", ipaddress)

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/Description$", blade.Description)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PartNumber$", blade.PartNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUNumber$", blade.FRUNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUSerialNumber$", blade.FRUSerialNumber)
If (blade.CaraFlag = "Normal") Then
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ModuleBay$", ModuleBay(blade.Bay,"Blade"))
ElseIf(blade.CaraFlag = "Upper") Then
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ModuleBay$", ModuleBayForCara(blade.Bay,"Upper"))
Else
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ModuleBay$", ModuleBayForCara(blade.Bay,"Lower"))
End If
Call oInst.AddProperty("$MPElement[Name='NetworkLibrary!System.NetworkManagement.Node']/DeviceKey$", ipaddress)

WScript.Echo ("blade.ChassisUUID__" + blade.ChassisUUID + "__")
WScript.Echo ("blade.UUID__" + blade.UUID + "__")
Dim IBBladeHostName
If( Len(blade.UUID) &lt;&gt; 39) Then
'If the length of UUID is not a valid number. The IB object can not be discovered.
Call LogDebugString("Incorrect Blade UUID:" + blade.UUID , WARNING_LEVEL_DEV)
Else
'Austin disabled for MP2.3 #504006
'result = SCOMServer.UpdateIBBladeSystem(ipaddress,blade.UUID )

'IBBladeHostName = SCOMServer.GetRelatedIBBladeName (blade.UUID)
'If IsEmpty(IBBladeHostName) then
'result = 1
'else
'Move to Relation .mp
'Call CreateHealthReflectionObject(blade.Description + "-" + ipaddress, IBBladeHostName)
result = 0
'end if
End If

WScript.Echo("BladeFRUSerialNumber " + blade.FRUSerialNumber)
'Call LogDebugString("CreateBlade at Bay :" + blade.Bay + " blade.Description: " + blade.Description, ERROR_LEVEL)

Call LogDebugString("Blade data created", INFO_LEVEL_DETAIL)
End If

Call oDiscoveryData.AddInstance(oInst)
End Function

'-----------------------------------------------------------------------------
' End of CreateBlade()
'-----------------------------------------------------------------------------
'-----------------------------------------------------------------------------
' start of CreateV7000(V7000)
'-----------------------------------------------------------------------------
Function CreateV7000(V7000)

Call LogDebugString("Entering CreateV7000",INFO_LEVEL_FUNCTION)
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.FlexSystem.Storage']$")


Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/MachineTypeModel$", V7000.MachineTypeModel)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/SerialNumber$", V7000.MachineSerialNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ComponentID$", V7000.ComponentID)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Storage']/Firmware$", V7000.Firmwares)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Storage']/PowerOnState$", V7000.PowerState)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ModuleBay$", "")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/BayNumber$", V7000.Name)
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", V7000.Name)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/Description$", V7000.Description)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ChassisUUID$", V7000.ChassisUUID)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/UUID$", V7000.UUID)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PrimaryMMIPAddress$", ipaddress)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PartNumber$", V7000.PartNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUNumber$", V7000.FRUNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUSerialNumber$", V7000.FRUSerialNumber)
Call oInst.AddProperty("$MPElement[Name='NetworkLibrary!System.NetworkManagement.Node']/DeviceKey$", ipaddress)
Call oDiscoveryData.AddInstance(oInst)

End Function
'-----------------------------------------------------------------------------
' start of CreateFSM()
'-----------------------------------------------------------------------------

Function CreateFSM(bayNumber,FSM)
'get IP from regedit
Const HKEY_LOCAL_MACHINE = &amp;H80000002
Const IBMHWMP_FSM_IP = "SOFTWARE\IBM\Systems Management Integrations\IBM HW Mgmt Pack for OpsMgr"
Const LenovoHWMP_FSM_IP = "SOFTWARE\Lenovo\Systems Management Integrations\Lenovo HW Mgmt Pack for OpsMgr"
Dim key_name
key_name = ipaddress + "_" + FSM.Name
Dim obj ,oReg,FSMIPaddress
Set oReg = GetObject("winmgmts://localhost/root/default:StdRegProv")
oReg.GetStringValue HKEY_LOCAL_MACHINE,LenovoHWMP_FSM_IP,Key_Name,FSMIPaddress
If IsNull(FSMIPaddress) Or IsEmpty(FSMIPaddress) Or FSMIPaddress = "" Then
oReg.GetStringValue HKEY_LOCAL_MACHINE,IBMHWMP_FSM_IP,Key_Name,FSMIPaddress
End If

Call LogDebugString("Entering CreateFSM",INFO_LEVEL_FUNCTION)
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.FlexSystem.FSM']$")

Call LogDebugString("Creating new FSM in slot " &amp; FSM.Bay &amp; "...", INFO_LEVEL_DETAIL)

Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", key_name)

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/MachineTypeModel$", FSM.MachineTypeModel)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/SerialNumber$", FSM.MachineSerialNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ComponentID$", FSM.ComponentID)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.FSM']/Firmware$", FSM.Firmwares)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.FSM']/PowerOnState$", FSM.PowerState)

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/BayNumber$","FSM Bay" + CStr(bayNumber))
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ChassisUUID$", FSM.ChassisUUID)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/UUID$", FSM.UUID)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PrimaryMMIPAddress$", ipaddress)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/CommunityString$", EncodeCmtyStr)

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/Description$", FSM.Description)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PartNumber$", FSM.PartNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUNumber$", FSM.FRUNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUSerialNumber$", FSM.FRUSerialNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ModuleBay$", ModuleBay(bayNumber,"FSM"))

Call oInst.AddProperty("$MPElement[Name='NetworkLibrary!System.NetworkManagement.Node']/DeviceKey$", ipaddress)


If IsNull(FSMIPaddress) Or IsEmpty(FSMIPaddress) Or FSMIPaddress = "" Then
FSMIPaddress = ""
End If
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.FSM']/FSMIPaddress$",FSMIPaddress)

Call oDiscoveryData.AddInstance(oInst)

End Function

'**
'* Uses the vpdDataIF to get the data about the Switch Module.
'* Creates an instance of this JScript's Switch class.
'**
'-----------------------------------------------------------------------------
' start of CreateSwitch()
'-----------------------------------------------------------------------------
Function CreateSwitch(bayNumber, ioModule)
Call LogDebugString("Entering CreateSwitch", INFO_LEVEL_FUNCTION)
Dim NA
NA = "Not Available"
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.FlexSystem.IOModule']$")
Call LogDebugString("Creating new IO Module in slot " &amp; slot &amp; "...", INFO_LEVEL)
If (IsNull(ioModule) Or ioModule Is Nothing) Then
Call LogDebugString("Error - Could not get information For IO Module in slot " &amp; bayNumber, WARNING_LEVEL_DEV)
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", ipaddress + "_" + NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.IOModule']/Firmware$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.IOModule']/PowerOnState$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.IOModule']/ConfigMethod$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.IOModule']/ConfigIPAddress$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ComponentID$", "CHASSIS[1]/IO_MOD[" &amp; bayNumber &amp; "]")

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/BayNumber$", "I/O Module Bay " + CStr(bayNumber))
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ChassisUUID$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/UUID$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PrimaryMMIPAddress$", ipaddress)

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/Description$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PartNumber$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUNumber$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUSerialNumber$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ModuleBay$", ModuleBay(bayNumber,"IO"))

' //Set relationship
' SetBladeCenterModuleRelationship(ref chassisModuleObject, IPAddress);
Call oInst.AddProperty("$MPElement[Name='NetworkLibrary!System.NetworkManagement.Node']/DeviceKey$", ipaddress)
Else
Dim SwithID
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", ipaddress + "_" + ioModule.Name)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.IOModule']/Firmware$", ioModule.Firmwares)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.IOModule']/PowerOnState$", ioModule.PowerState)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.IOModule']/ConfigMethod$", ioModule.Configuration)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.IOModule']/ConfigIPAddress$", ioModule.IPAddress)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ComponentID$", ioModule.ComponentID )

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/BayNumber$", "I/O Module Bay " + ioModule.Bay)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ChassisUUID$", ioModule.ChassisUUID)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/UUID$", ioModule.UUID)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PrimaryMMIPAddress$", ipaddress)


Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/Description$", ioModule.Description)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PartNumber$", ioModule.PartNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUNumber$", ioModule.FRUNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUSerialNumber$", ioModule.FRUSerialNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ModuleBay$", ModuleBay(ioModule.Bay,"IO"))

' //Set relationship
' SetBladeCenterModuleRelationship(ref chassisModuleObject, IPAddress);

Call oInst.AddProperty("$MPElement[Name='NetworkLibrary!System.NetworkManagement.Node']/DeviceKey$", ipaddress)

WScript.Echo ("ioModule.UUID__" + ioModule.UUID + "__")
WScript.Echo ("ioModule.ChassisUUID__" + ioModule.ChassisUUID + "__")
Call LogDebugString("ioModule.ChassisUUID__" + ioModule.ChassisUUID, INFO_LEVEL_DETAIL)

End If

Call oDiscoveryData.AddInstance(oInst)
End Function
'-----------------------------------------------------------------------------
' End of CreateSwitch()
'-----------------------------------------------------------------------------

'**
'* Uses the vpdDataIF to get data about the Power Module.
'* Creates an instance of this JScript's Power class.
'**
'-----------------------------------------------------------------------------
' Start of CreatePower()
'-----------------------------------------------------------------------------
Function CreatePower(bayNumber, power)
Dim NA
NA = "Not Available"
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.FlexSystem.PowerModule']$")

Call LogDebugString("Creating new Power Module in slot " &amp; bayNumber &amp; "...", INFO_LEVEL_FUNCTION)
Dim name
name = "Power" &amp; bayNumber

If (IsNull(power) Or power Is Nothing) Then
Call LogDebugString("Error - power module is null", WARNING_LEVEL_DEV)
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", ipaddress + "_" + NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.PowerModule']/Firmware$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ComponentID$", "CHASSIS[1]/POWER[" &amp; bayNumber &amp; "]")

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/BayNumber$", "Power Module Bay " + CStr(bayNumber))
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ChassisUUID$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/UUID$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PrimaryMMIPAddress$", ipaddress)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/Description$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PartNumber$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUNumber$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUSerialNumber$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ModuleBay$", ModuleBay(bayNumber,"Power"))

' //Set relationship
Call oInst.AddProperty("$MPElement[Name='NetworkLibrary!System.NetworkManagement.Node']/DeviceKey$", ipaddress)
Else
Call LogDebugString("Power Module name = " &amp; name, INFO_LEVEL_DETAIL)

Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", ipaddress + "_" + power.Name)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.PowerModule']/Firmware$", power.Firmware)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ComponentID$", power.ComponentID)

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/BayNumber$", "Power Module Bay " + power.Bay)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ChassisUUID$", power.ChassisUUID)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/UUID$", power.UUID)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PrimaryMMIPAddress$", ipaddress)


Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/Description$", power.Description)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PartNumber$", power.PartNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUNumber$", power.FRUNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUSerialNumber$", power.FRUSerialNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ModuleBay$", ModuleBay(power.Bay,"Power"))

' //Set relationship
Call oInst.AddProperty("$MPElement[Name='NetworkLibrary!System.NetworkManagement.Node']/DeviceKey$", ipaddress)

End If

Call oDiscoveryData.AddInstance(oInst)

End Function
'-----------------------------------------------------------------------------
' End of CreatePower()
'-----------------------------------------------------------------------------

Function CreateFanMux(bayNumber, fanmux)
Dim NA
NA = "Not Available"
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.FlexSystem.FanMuxModule']$")

Call LogDebugString("Creating new FanMux Module in slot " &amp; bayNumber &amp; "...", INFO_LEVEL_FUNCTION)
Dim name
name = "FanMux" &amp; bayNumber

If (IsNull(fanmux) Or fanmux Is Nothing) Then
Call LogDebugString("Error - FanMux module is null", WARNING_LEVEL_DEV)
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", ipaddress + "_" + NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.FanMuxModule']/Firmware$", NA)

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/BayNumber$", "FanMux Module Bay " + CStr(bayNumber))
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ChassisUUID$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/UUID$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PrimaryMMIPAddress$", ipaddress)


Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ComponentID$", "CHASSIS[1]/FANMUX[" &amp; bayNumber &amp; "]")

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/Description$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PartNumber$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUNumber$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUSerialNumber$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ModuleBay$", ModuleBay(bayNumber,"FanMux"))

' //Set relationship
Call oInst.AddProperty("$MPElement[Name='NetworkLibrary!System.NetworkManagement.Node']/DeviceKey$", ipaddress)
Else
Call LogDebugString("FanMux Module name = " &amp; name, INFO_LEVEL_DETAIL)

Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", ipaddress + "_" + fanmux.Name)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.FanMuxModule']/Firmware$", fanmux.Firmware)

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ComponentID$", fanmux.ComponentID )

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/BayNumber$", "FanMux Module Bay " + fanmux.Bay)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ChassisUUID$", fanmux.ChassisUUID)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/UUID$", fanmux.UUID)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PrimaryMMIPAddress$", ipaddress)


Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/Description$", fanmux.Description)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PartNumber$", fanmux.PartNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUNumber$", fanmux.FRUNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUSerialNumber$", fanmux.FRUSerialNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ModuleBay$", ModuleBay(fanmux.Bay,"FanMux"))

' //Set relationship
Call oInst.AddProperty("$MPElement[Name='NetworkLibrary!System.NetworkManagement.Node']/DeviceKey$", ipaddress)

End If

Call oDiscoveryData.AddInstance(oInst)

End Function

Function CreateRearLED(bayNumber, rearLED)
Dim NA
NA = "Not Available"
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.FlexSystem.RearLEDModule']$")

Call LogDebugString("Creating new RearLED Module in slot " &amp; bayNumber &amp; "...", INFO_LEVEL_FUNCTION)
Dim name
name = "RearLED" &amp; bayNumber

If (IsNull(rearLED) Or rearLED Is Nothing) Then
Call LogDebugString("Error - RearLED module is null", WARNING_LEVEL_DEV)
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", ipaddress + "_" + NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.RearLEDModule']/Firmware$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ComponentID$", "CHASSIS[1]/LED_MOD[" &amp; bayNumber &amp; "]")

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/BayNumber$", "RearLED Module Bay " + CStr(bayNumber))
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ChassisUUID$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/UUID$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PrimaryMMIPAddress$", ipaddress)


Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/Description$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PartNumber$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUNumber$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUSerialNumber$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ModuleBay$", ModuleBay(bayNumber,"RearLED"))

' //Set relationship
Call oInst.AddProperty("$MPElement[Name='NetworkLibrary!System.NetworkManagement.Node']/DeviceKey$", ipaddress)
Else
Call LogDebugString("RearLED Module name = " &amp; name, INFO_LEVEL_DETAIL)

Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", ipaddress + "_" + rearLED.Name)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.RearLEDModule']/Firmware$", rearLED.Firmware)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ComponentID$", rearLED.ComponentID)

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/BayNumber$", "RearLED Module Bay " + rearLED.Bay)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ChassisUUID$", rearLED.ChassisUUID)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/UUID$", rearLED.UUID)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PrimaryMMIPAddress$", ipaddress)


Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/Description$", rearLED.Description)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PartNumber$", rearLED.PartNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUNumber$", rearLED.FRUNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUSerialNumber$", rearLED.FRUSerialNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ModuleBay$", ModuleBay(rearLED.Bay,"RearLED"))

' //Set relationship
Call oInst.AddProperty("$MPElement[Name='NetworkLibrary!System.NetworkManagement.Node']/DeviceKey$", ipaddress)

End If

Call oDiscoveryData.AddInstance(oInst)

End Function



'-----------------------------------------------------------------------------
' Start of CreateBlower()
'-----------------------------------------------------------------------------
Function CreateBlower(bayNumber,blower)
Dim NA
NA = "Not Available"
Call LogDebugString("Entering CreateBlower", INFO_LEVEL_FUNCTION)
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.FlexSystem.CoolingModule']$")
If (IsNull(blower) Or blower Is Nothing) Then
Call LogDebugString("Error - Blower module is null", WARNING_LEVEL_DEV)
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", ipaddress + "_" + NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.CoolingModule']/Firmware$", NA)

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ComponentID$", "CHASSIS[1]/COOLING[" &amp; bayNumber &amp; "]")

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/BayNumber$", "Cooling Module Bay " + CStr(bayNumber))
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ChassisUUID$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/UUID$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PrimaryMMIPAddress$", ipaddress)

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/Description$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PartNumber$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUNumber$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUSerialNumber$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ModuleBay$", ModuleBay(bayNumber,"Blower"))

' //Set relationship
Call oInst.AddProperty("$MPElement[Name='NetworkLibrary!System.NetworkManagement.Node']/DeviceKey$", ipaddress)
Else
Call LogDebugString("Creating new Blower Module in bay " &amp; bayNumber &amp; "...", INFO_LEVEL_DETAIL)
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", ipaddress + "_" + blower.Name)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.CoolingModule']/Firmware$", blower.Firmware)

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ComponentID$", blower.ComponentID )

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/BayNumber$", "Cooling Module Bay " + blower.Bay)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ChassisUUID$", blower.ChassisUUID)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/UUID$", blower.UUID)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PrimaryMMIPAddress$", ipaddress)

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/Description$", blower.Description)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PartNumber$", blower.PartNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUNumber$", blower.FRUNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUSerialNumber$", blower.FRUSerialNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ModuleBay$", ModuleBay(blower.Bay,"Blower"))

' //Set relationship
Call oInst.AddProperty("$MPElement[Name='NetworkLibrary!System.NetworkManagement.Node']/DeviceKey$", ipaddress)

End If

Call oDiscoveryData.AddInstance(oInst)

End Function
'-----------------------------------------------------------------------------
' End of CreateBlower()
'-----------------------------------------------------------------------------

'**
'* Uses the vpdDataIF to get the data about the Management Module.
'* Creates an instance of this JScript's Management class.
'**
'-----------------------------------------------------------------------------
' Start of CreateManagement()
'-----------------------------------------------------------------------------
Function CreateManagement(bayNumber, mmMod)
Dim NA
NA = "Not Available"
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.FlexSystem.ManagementModule']$")

Call LogDebugString("Creating new Management Module in bay " &amp; bayNumber &amp; "...", INFO_LEVEL_DETAIL)

Dim mgmt
mgmt = Null
Call LogDebugString("mmMod getting... ", INFO_LEVEL_DETAIL)

Dim name
name = "Management" &amp; bayNumber

If (IsNull(mmMod) Or mmMod Is Nothing) Then
Call LogDebugString("Error - management module is null", WARNING_LEVEL_DEV)
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", ipaddress + "_" + NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.ManagementModule']/Firmware$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.ManagementModule']/ExternalIPAddress$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.ManagementModule']/ExternalIPConfigMethod$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ComponentID$", "CHASSIS[1]/MGT_MOD[" &amp; bayNumber &amp; "]")

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/BayNumber$", "Management Module Bay " + CStr(bayNumber))
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ChassisUUID$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/UUID$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PrimaryMMIPAddress$", ipaddress)

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/Description$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PartNumber$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUNumber$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUSerialNumber$", NA)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ModuleBay$", ModuleBay(bayNumber,"MM"))

' //Set relationship
Call oInst.AddProperty("$MPElement[Name='NetworkLibrary!System.NetworkManagement.Node']/DeviceKey$", ipaddress)
Else
Call LogDebugString("Media Module name= " &amp; name, INFO_LEVEL_DETAIL)

Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", ipaddress + "_" + mmMod.Name)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.ManagementModule']/Firmware$", mmMod.Firmware)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.ManagementModule']/ExternalIPAddress$", mmMod.IPAddress)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.ManagementModule']/ExternalIPConfigMethod$", "Not Available")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ComponentID$", mmMod.ComponentID )

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/BayNumber$", "Management Module Bay " + mmMod.Bay)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ChassisUUID$", mmMod.ChassisUUID)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/UUID$", mmMod.UUID)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PrimaryMMIPAddress$", ipaddress)


Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/Description$", mmMod.Description)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PartNumber$", mmMod.PartNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUNumber$", mmMod.FRUNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUSerialNumber$", mmMod.FRUSerialNumber)
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ModuleBay$", ModuleBay(mmMod.Bay,"MM"))

' //Set relationship
Call oInst.AddProperty("$MPElement[Name='NetworkLibrary!System.NetworkManagement.Node']/DeviceKey$", ipaddress)

Call LogDebugString("Management Module created", INFO_LEVEL_DETAIL)
End If
If (bayNumber = 1) Then
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.ManagementModule']/EventInsert$", "2629633")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.ManagementModule']/EventRemove$", "2637825")
Else
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.ManagementModule']/EventInsert$", "2629634")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.ManagementModule']/EventRemove$", "2637826")
End If

Call oDiscoveryData.AddInstance(oInst)

End Function



'-----------------------------------------------------------------------------
' End of CreateManagement()
'-----------------------------------------------------------------------------



'-----------------------------------------------------------------------------
' Start of CreatePseudo
'-----------------------------------------------------------------------------
Function CreatePseudo(bayNumber,typee,chassisUUID,slotNumber)
Call LogDebugString("Creating Pseudo Module in slot " &amp; bayNumber &amp; "...", INFO_LEVEL_FUNCTION)
' Call SCOMServer.AddPseudoToCenter(ipaddress, bayNumber,typee,0)
Select Case typee
Case "Blade"
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.FlexSystem.BladeModule']$")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/MachineTypeModel$", "")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/SerialNumber$", "")
'Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.BladeModule']/BladeExpansionCardList$", "")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.BladeModule']/Firmware$", "")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.BladeModule']/PowerOnState$", "")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ModuleBay$", ModuleBay(bayNumber,"Blade"))
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/BayNumber$", "Node Bay " + CStr(bayNumber))
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", ipaddress + "_" + "Node Bay " + CStr(bayNumber) + " - &lt;Empty&gt;")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ComponentID$", "CHASSIS[1]/BLADE[" &amp; bayNumber &amp; "]")

Case "IO"
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.FlexSystem.IOModule']$")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.IOModule']/Firmware$", "")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.IOModule']/PowerOnState$", "")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.IOModule']/ConfigMethod$", "")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.IOModule']/ConfigIPAddress$", "")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ModuleBay$", ModuleBay(bayNumber,"IO"))
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/BayNumber$", "I/O Module Bay " + CStr(bayNumber))
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", ipaddress + "_" + "I/O Module Bay " + CStr(bayNumber) + " - &lt;Empty&gt;")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ComponentID$", "CHASSIS[1]/IO_MOD[" &amp; bayNumber &amp; "]")

Case "MM"
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.FlexSystem.ManagementModule']$")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.ManagementModule']/Firmware$", "")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.ManagementModule']/ExternalIPAddress$", "")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.ManagementModule']/ExternalIPConfigMethod$", "")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ModuleBay$", ModuleBay(bayNumber,"MM"))
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/BayNumber$", "Management Module Bay " + CStr(bayNumber))
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", ipaddress + "_" + "Management Module Bay " + CStr(bayNumber) + " - &lt;Empty&gt;")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ComponentID$", "CHASSIS[1]/MGT_MOD[" &amp; bayNumber &amp; "]")
If (bayNumber = 1) Then

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.ManagementModule']/EventInsert$", "2629633")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.ManagementModule']/EventRemove$", "2637825")
Else
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.ManagementModule']/EventInsert$", "2629634")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.ManagementModule']/EventRemove$", "2637826")
End If

Case "Power"
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.FlexSystem.PowerModule']$")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.PowerModule']/Firmware$", "")

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ModuleBay$", ModuleBay(bayNumber,"Power"))
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/BayNumber$", "Power Module Bay " + CStr(bayNumber))
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", ipaddress + "_" + "Power Module Bay " + CStr(bayNumber) + " - &lt;Empty&gt;")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ComponentID$", "CHASSIS[1]/POWER[" &amp; bayNumber &amp; "]")

Case "Blower"
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.FlexSystem.CoolingModule']$")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.CoolingModule']/Firmware$", "")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ModuleBay$", ModuleBay(bayNumber,"Blower"))
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/BayNumber$", "Cooling Module Bay " + CStr(bayNumber))
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", ipaddress + "_" + "Cooling Module Bay " + CStr(bayNumber) + " - &lt;Empty&gt;")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ComponentID$", "CHASSIS[1]/COOLING[" &amp; bayNumber &amp; "]")

Case "FanMux"
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.FlexSystem.FanMuxModule']$")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.FanMuxModule']/Firmware$", "")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ModuleBay$", ModuleBay(bayNumber,"FanMux"))
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/BayNumber$", "FanMux Module Bay " + CStr(bayNumber))
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", ipaddress + "_" + "FanMux Module Bay " + CStr(bayNumber) + " - &lt;Empty&gt;")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ComponentID$", "CHASSIS[1]/FANMUX[" &amp; bayNumber &amp; "]")

Case "RearLED"
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='IBM.FlexSystem.RearLEDModule']$")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.RearLEDModule']/Firmware$", "")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ModuleBay$", ModuleBay(bayNumber,"RearLED"))
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/BayNumber$", "RearLED Module Bay " + CStr(bayNumber))
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", ipaddress + "_" + "RearLED Module Bay " + CStr(bayNumber) + " - &lt;Empty&gt;")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ComponentID$", "CHASSIS[1]/LED_MOD[" &amp; bayNumber &amp; "]")



End Select

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/Description$", "")

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ChassisUUID$", "")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/UUID$", "")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PrimaryMMIPAddress$", ipaddress)

Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/PartNumber$", "")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUNumber$", "")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/FRUSerialNumber$", "")


'Set relationship
'SetBladeCenterModuleRelationship(ref pseudoObject, IPAddress);
Call oInst.AddProperty("$MPElement[Name='NetworkLibrary!System.NetworkManagement.Node']/DeviceKey$", ipaddress)
Call LogDebugString("CreatePseudo " + typee + " instance at Bay: " + CStr(bayNumber),INFO_LEVEL_DETAIL )
Call oDiscoveryData.AddInstance(oInst)

End Function
'-----------------------------------------------------------------------------
' End of CreatePseudo()
'-----------------------------------------------------------------------------
Function ModuleBayForCara(bayNumber,typ)

ModuleBayForCara = "Node_"
If( bayNumber &gt;= 100 ) Then
Call LogDebugString("Error Bay Number for Node Module", WARNING_LEVEL)
Exit Function
End If

If(bayNumber &lt; 10) Then
ModuleBayForCara = ModuleBayForCara + "0" + CStr(bayNumber) + "Cara_"
Else
ModuleBayForCara = ModuleBayForCara + CStr(bayNumber) + "Cara_"
End If

Select Case typ
Case "Upper"
ModuleBayForCara = ModuleBayForCara + "01"
Case "Lower"
ModuleBayForCara = ModuleBayForCara + "02"
End Select

End Function

Function ModuleBay(bayNumber,typee)

ModuleBay = "Not Available"
If( bayNumber &gt;= 100 ) Then
Call LogDebugString("Error Bay Number for " + typee + " Module", WARNING_LEVEL)
Exit Function
End If

Select Case typee
Case "FSM"
ModuleBay = "FSM_"
Case "Blade"
ModuleBay = "Node_"
Case "IO"
ModuleBay = "IOMod_"
Case "MM"
ModuleBay = "MM_"
Case "Power"
ModuleBay = "Power_"
Case "Blower"
ModuleBay = "Cool_"
Case "FanMux"
ModuleBay = "FanMux_"
Case "RearLED"
ModuleBay = "RearLED_"
Case "CaraCara"
ModuleBay = "Node_CaraCara_"
Case "Storage"
ModuleBay = "Stor_"
'case "DiskDrive"

End Select
If ModuleBay = "Not Available" Then
Exit Function
End If

If(bayNumber &lt; 10) Then
ModuleBay = ModuleBay + "0" + CStr(bayNumber)
Else
ModuleBay = ModuleBay + CStr(bayNumber)
End If

End Function


'**
'* Creates a string to represent the installed state. For example:
'* there are 4 power modules maximum - two installed. One installed
'* in slot 0, one in slot 2. This routine should return:
'* "true, false, true, false". *
'**
'-----------------------------------------------------------------------------
' Start of InstalledString()
'-----------------------------------------------------------------------------
Function InstalledString(count, installed)

Call LogDebugString("Creating installed string", INFO_LEVEL_FUNCTION)
Dim installString
installString = ""
Dim i
i = 0
For Each item In installed
If (item = True) Then
installString = installString &amp; "true"
Else
installString = installString &amp; "false"
End If
If (i &lt; count - 1) Then
installString = installString &amp; ","
End If
i = i + 1
Next
InstalledString = installString
End Function
'-----------------------------------------------------------------------------
'End of Main()
'-----------------------------------------------------------------------------


'-----------------------------------------------------------------------------
'start of IsInstallBCCProject()
'This Function judges whether the target machine installed or not
'IBM Assemblies For Systems Management Support.
'-----------------------------------------------------------------------------
Function IsInstallBCCProject()
Dim IsInstalled
IsInstalled = True
Dim obj
Set obj = WScript.CreateObject("WScript.Shell")

Dim regpath
regpath = "HKEY_LOCAL_MACHINE\SOFTWARE\Lenovo\Systems Management Integrations\Lenovo HW Mgmt Pack for OpsMgr\Path"
Dim InstallPath
InstallPath = obj.RegRead(regpath)

If isNull(InstallPath) then
regpath = "HKEY_LOCAL_MACHINE\SOFTWARE\IBM\Systems Management Integrations\IBM HW Mgmt Pack for OpsMgr\Path"
InstallPath = obj.RegRead(regpath)
End If

If Not IsNull(InstallPath) Then
IsInstalled = True
Else
WScript.Echo("!!!!!!!!!!Error: BCC Not Installed!!!!!!!!!!!!")
End If
IsInstallBCCProject = IsInstalled
'WScript.Echo(IsInstalled)
End Function
'-------------------------------------------------------------------------------
'end of IsInstallBCCProject()
'-------------------------------------------------------------------------------


Sub GetDebugLevel()

' Const HKEY_LOCAL_MACHINE = &amp;H80000002
' Const DEBUG_INFO_KEY = "SOFTWARE\Lenovo\Lenovo SCOM MP\Debug"
' Const DEBUG_LEVEL_NAME = "Level"
Dim oReg,RC_Code
' 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, Regdebug)
If ( RC_Code &lt;&gt; 0) Then
Regdebug = -1
End If
End If

End Sub

'-------------------------------------------------------------------------------
'start of LogDebugString()
'-------------------------------------------------------------------------------
Sub LogDebugString(debugString, debugLevel)

If (Int(Regdebug) &gt;= Int(debugLevel)) Then
Call oAPI.LogScriptEvent("IBMFlexChassisModuleDiscovery.vbs", 221, DebugLevelToLogLevel(debugLevel), debugString)
End If

End Sub

Function DebugLevelToLogLevel(debugLevel)
DebugLevelToLogLevel = 4
If debugLevel &lt;= 1 Then
DebugLevelToLogLevel = 1
ElseIf debugLevel &lt;= 3 Then
DebugLevelToLogLevel = 2
Else
DebugLevelToLogLevel = 4
End If
End Function

'-------------------------------------------------------------------------------
'start of SCOMCreateObject()
'-------------------------------------------------------------------------------
Function SCOMCreateObject(ByVal sProgramId)

Dim oError
Set oError = New Error

On Error Resume Next
Set SCOMCreateObject = CreateObject(sProgramId)
oError.Save
On Error GoTo 0

If (oError.Number &lt;&gt; 0) Then
Call LogDebugString("Error to create object", ERROR_LEVEL)
WScript.Quit
End If

End Function
'-------------------------------------------------------------------------------
'end of SCOMCreateObject()
'-------------------------------------------------------------------------------
Function Chr2Unicode(ByVal str)
Dim st, t, i
For i = 1 To Len(str) Step 2
t = Mid(str, i, 1)
st = st + t
Next
Chr2Unicode = st
End Function

Function fDecode(sStringToDecode)
'This function will decode a Base64 encoded string and returns the decoded string.
Const CharList = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
Dim iDataLength, sOutputString, iGroupInitialCharacter
sStringToDecode = Replace(Replace(Replace(sStringToDecode, vbCrLf, ""), vbTab, ""), " ", "")
iDataLength = Len(sStringToDecode)
If iDataLength Mod 4 &lt;&gt; 0 Then
fDecode = "Bad string passed to fDecode() function."
Exit Function
End If
For iGroupInitialCharacter = 1 To iDataLength Step 4
Dim iDataByteCount, iCharacterCounter, sCharacter, iData, iGroup, sPreliminaryOutString
iDataByteCount = 3
iGroup = 0
For iCharacterCounter = 0 To 3
sCharacter = Mid(sStringToDecode, iGroupInitialCharacter + iCharacterCounter, 1)
If sCharacter = "=" Then
iDataByteCount = iDataByteCount - 1
iData = 0
Else
iData = InStr(1, CharList, sCharacter, 0) - 1
If iData = -1 Then
fDecode = "Bad string passed to fDecode() function."
Exit Function
End If
End If
iGroup = 64 * iGroup + iData
Next
iGroup = Hex(iGroup)
iGroup = String(6 - Len(iGroup), "0") &amp; iGroup
sPreliminaryOutString = Chr(CByte("&amp;H" &amp; Mid(iGroup, 1, 2))) &amp; Chr(CByte("&amp;H" &amp; Mid(iGroup, 3, 2))) &amp; Chr(CByte("&amp;H" &amp; Mid(iGroup, 5, 2)))
sOutputString = sOutputString &amp; Left(sPreliminaryOutString, iDataByteCount)
Next
fDecode = sOutputString
End Function

Function ConvertUUID(uuid)
Dim temp, UUID2
temp = UCase(uuid)
For i = 1 To 8

UUID2 = UUID2 + Mid(temp,1 + (i - 1) * 4 ,4) + " "

ConvertUUID = Trim(UUID2)
Next
End Function

Class Error
Private lNumber
Private sSource
Private sDescription
Private sHelpContext
Private sHelpFile
Public Sub Save()
lNumber = Err.number
sSource = Err.Source
sDescription = Err.Description
sHelpContext = Err.HelpContext
sHelpFile = Err.helpfile
End Sub
Public Sub Raise()
Err.Raise lNumber, sSource, sDescription, sHelpFile, sHelpContext
End Sub
Public Sub Clear()
lNumber = 0
sSource = ""
sDescription = ""
sHelpContext = ""
sHelpFile = ""
End Sub
Public Default Property Get Number()
Number = lNumber
End Property
Public Property Get Source()
Source = sSource
End Property
Public Property Get Description()
Description = sDescription
End Property
Public Property Get HelpContext()
HelpContext = sHelpContext
End Property
Public Property Get HelpFile()
HelpFile = sHelpFile
End Property
End Class

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