'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 < 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"!!!!!!!!!
'-----------------------------------------------------------------------------
' End of Main
'-----------------------------------------------------------------------------
bccInstalled = IsInstallBCCProject()
If (IsNull(ipaddress)) Then
Call LogDebugString("Error: Bad or missing ipaddress!", ERROR_LEVEL)
Else
Set bladeChassis = WScript.CreateObject("Lenovo.SystemsManagement.CMMClassLibrary.FlexChassis")
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 " & " at " & ipaddress)
Call LogDebugString("Inventory For chassis " & " at " & 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
Call LogDebugString("init = " & 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 <> 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 = " & loggedin, INFO_LEVEL)
If (loggedin = 0) Then
Dim retval
retval = bladeChassis.GetTopology() '->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 = " & bladeModuleCount)
WScript.Echo("===========================================")
Call LogDebugString("MaxbladeModuleCount = " & bladeModuleCount, INFO_LEVEL_DETAIL)
Dim num
For num = 0 To 13
Dim item
item = bladesInstalled(num)
WScript.Echo("num=" & num)
If (item = True) Then
WScript.Echo("item=true,bayNumber=" & bayNumber)
If (IsNull(bladeChassis.GetBladeModule(bayNumber)) Or bladeChassis.GetBladeModule(bayNumber) Is Nothing) Then
WScript.Echo("Create Blade Pseudo bayNumber=" & bayNumber)
Call CreatePseudo(bayNumber,"Blade",chassisUUID ,0)
bayNumber = bayNumber + 1
WScript.Echo("CreatePseudo Current bayNumber=" & 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=" & bayNumber)
Call CreateBlade(bayNumber,bladeChassis.GetBladeModule(bayNumber))
Else
WScript.Echo("This Blade is CaraCara! Create the up node of Real Blade bayNumber=" & bayNumber)
Call CreateBlade(bayNumber,bladeChassis.GetBladeModuleOfCara(bayNumber))
WScript.Echo("Create the lower node of the Slot = " & bayNumber)
Call CreateBlade(bayNumber,bladeChassis.GetBladeModule(bayNumber))
WScript.Echo("blade.SlotWidth=" & bladeChassis.GetBladeModule(bayNumber).SlotWidth)
End If
If (bladeChassis.GetBladeModule(bayNumber).SlotWidth > 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=" & bayNumber)
End If
Else
WScript.Echo("item=false,Create Blade Pseudo bayNumber=" & bayNumber)
Call CreatePseudo(bayNumber,"Blade",chassisUUID ,0)
bayNumber = bayNumber + 1
WScript.Echo("BladeInstalled Current bayNumber=" & bayNumber)
End If
WScript.Echo("bayNumber=" & bayNumber)
If bayNumber > bladeModuleCount Then
Exit For
End If
Next
'Storage for V7000
V7000Count = bladeChassis.GetV7000ModuleCount()
WScript.Echo("=======================================")
Call WScript.Echo(" MaxV7000ModuleCount =" & V7000Count)
WScript.Echo("=======================================")
Call LogDebugString(" MaxV7000ModuleCount =" & 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 =" & fsmModuleCount)
WScript.Echo("========================================")
Call LogDebugString("MaxfsmModuleCount =" & fsmModuleCount,INFO_LEVEL_DETAIL)
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
Call LogDebugString("ioModuleCount = " & ioModuleCount, INFO_LEVEL_DETAIL)
WScript.Echo("===========================================")
Call WScript.Echo(" MaxioModuleCount = " & 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 >= 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 = " & mmModuleCount, INFO_LEVEL)
bayNumber = 0
Call LogDebugString("MaxmmModuleCount = " & mmModuleCount, INFO_LEVEL_DETAIL)
WScript.Echo("===========================================")
Call WScript.Echo(" MaxmmModuleCount = " & 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 >= 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 = " & powerModuleCount, INFO_LEVEL_DETAIL)
WScript.Echo("===========================================")
Call WScript.Echo(" MaxpowerModuleCount = " & 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 >= 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 = " & blowerModuleCount, INFO_LEVEL_DETAIL)
WScript.Echo("===========================================")
Call WScript.Echo(" MaxblowerModuleCount = " & 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 >= 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 = " & fanmuxModuleCount, INFO_LEVEL_DETAIL)
WScript.Echo("===========================================")
Call WScript.Echo(" MaxFanMuxModuleCount = " & 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 >= 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 = " & rearLEDModuleCount, INFO_LEVEL_DETAIL)
WScript.Echo("===========================================")
Call WScript.Echo(" MaxRearLEDModuleCount = " & 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 >= rearLEDModuleCount Then
Exit For
End If
Next
'lin component key uuid-> 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 = " & 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 " & "...", INFO_LEVEL_DETAIL)
Dim chassisID
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 " & bayNumber, WARNING_LEVEL)
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", ipaddress + "_" + NA)
'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 >1, " & 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) & " - <Part of Node Bay " & CStr( bayNumber) & "," & CStr( bayNumber + 1) & "," & CStr( bayNumber + 2) & "," & CStr( bayNumber + 3) & ">")
'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']/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) <> 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']$")
End Function
'-----------------------------------------------------------------------------
' start of CreateFSM()
'-----------------------------------------------------------------------------
Function CreateFSM(bayNumber,FSM)
'get IP from regedit
Const HKEY_LOCAL_MACHINE = &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 " & FSM.Bay & "...", INFO_LEVEL_DETAIL)
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 " & slot & "...", INFO_LEVEL)
If (IsNull(ioModule) Or ioModule Is Nothing) Then
Call LogDebugString("Error - Could not get information For IO Module in slot " & 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[" & bayNumber & "]")
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 " & bayNumber & "...", INFO_LEVEL_FUNCTION)
Dim name
name = "Power" & 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[" & bayNumber & "]")
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 " & bayNumber & "...", INFO_LEVEL_FUNCTION)
Dim name
name = "FanMux" & 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)
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 " & bayNumber & "...", INFO_LEVEL_FUNCTION)
Dim name
name = "RearLED" & 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[" & bayNumber & "]")
'-----------------------------------------------------------------------------
' 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[" & bayNumber & "]")
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 " & bayNumber & "...", INFO_LEVEL_DETAIL)
Dim mgmt
mgmt = Null
Call LogDebugString("mmMod getting... ", INFO_LEVEL_DETAIL)
Dim name
name = "Management" & 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[" & bayNumber & "]")
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 " & bayNumber & "...", 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) + " - <Empty>")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ComponentID$", "CHASSIS[1]/BLADE[" & bayNumber & "]")
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) + " - <Empty>")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ComponentID$", "CHASSIS[1]/IO_MOD[" & bayNumber & "]")
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) + " - <Empty>")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ComponentID$", "CHASSIS[1]/MGT_MOD[" & bayNumber & "]")
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) + " - <Empty>")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ComponentID$", "CHASSIS[1]/POWER[" & bayNumber & "]")
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) + " - <Empty>")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ComponentID$", "CHASSIS[1]/COOLING[" & bayNumber & "]")
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) + " - <Empty>")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ComponentID$", "CHASSIS[1]/FANMUX[" & bayNumber & "]")
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) + " - <Empty>")
Call oInst.AddProperty("$MPElement[Name='IBM.FlexSystem.Module']/ComponentID$", "CHASSIS[1]/LED_MOD[" & bayNumber & "]")
End Function
'-----------------------------------------------------------------------------
' End of CreatePseudo()
'-----------------------------------------------------------------------------
Function ModuleBayForCara(bayNumber,typ)
ModuleBayForCara = "Node_"
If( bayNumber >= 100 ) Then
Call LogDebugString("Error Bay Number for Node Module", WARNING_LEVEL)
Exit Function
End If
If(bayNumber < 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 >= 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 < 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 & "true"
Else
installString = installString & "false"
End If
If (i < count - 1) Then
installString = installString & ","
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 = &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 <> 0) Then
Regdebug = -1
End If
End If
End Sub
'-------------------------------------------------------------------------------
'start of LogDebugString()
'-------------------------------------------------------------------------------
Sub LogDebugString(debugString, debugLevel)
If (Int(Regdebug) >= Int(debugLevel)) Then
Call oAPI.LogScriptEvent("IBMFlexChassisModuleDiscovery.vbs", 221, DebugLevelToLogLevel(debugLevel), debugString)
End If
End Sub
Function DebugLevelToLogLevel(debugLevel)
DebugLevelToLogLevel = 4
If debugLevel <= 1 Then
DebugLevelToLogLevel = 1
ElseIf debugLevel <= 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 <> 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 <> 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") & iGroup
sPreliminaryOutString = Chr(CByte("&H" & Mid(iGroup, 1, 2))) & Chr(CByte("&H" & Mid(iGroup, 3, 2))) & Chr(CByte("&H" & Mid(iGroup, 5, 2)))
sOutputString = sOutputString & Left(sPreliminaryOutString, iDataByteCount)
Next
fDecode = sOutputString
End Function
Function ConvertUUID(uuid)
Dim temp, UUID2
temp = UCase(uuid)
For i = 1 To 8
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