Call LogDebugString("IBMHwMgmtSoftwareDiscovery.vbs " & sourceID & " " & _
managedEntityID & " " & _
managementGroupName & " " & _
targetComputerPrincipalName & " " & _
isBMCPresented & " " & _
isRSAPresented, INFO_LEVEL_DETAIL)
Set oDiscoveryData = oAPI.CreateDiscoveryData(0, sourceID, managedEntityID)
If (CreateHwMgmtSoftwareInstances() > 0) Then
Call LogDebugString("Created Management Software", INFO_LEVEL_DETAIL)
End If
Call oAPI.Return(oDiscoveryData)
End Sub
Function CreateHwMgmtSoftwareInstances()
Call LogDebugString("Entering CreateHwMgmtSoftwareInstances", INFO_LEVEL_FUNCTION)
Dim osVersion, spVersion, iOSAIPMICreated
'Create instance for Director Core Service all the time
If (CreateSoftwareInstance(SW_IBM_DA) > 0) Then
Call LogDebugString("Created instance of Director Core Services", INFO_LEVEL_DETAIL)
CreateHwMgmtSoftwareInstances = CreateHwMgmtSoftwareInstances + 1
End If
' [d504936/byou: moved it down for Adaptec SR agent and LSI IR/MR provider] -- If IsSoftwareRunning(SW_IBM_DA) > 0 Then
'Create instance for BMC Enablement(OSA IPMI, Lenovo Mapping Layer, Microsoft IPMI)
If Instr(isBMCPresented, "None") = 0 Then
If GetOSInfo(osVersion, spVersion) < 0 Then
Call LogDebugString("Could not get OS Info", WARNING_LEVEL_DEV)
Exit Function
End If
'Create OSA IPMI
' Earlier than win2k3, or Win2k3 but not R2.
If (StrComp(osVersion, "5.2.0000") < 0) or (IsRegExpMatched(osVersion, "^5\.2\.") and ( 1 <> IsWin2k3r2())) Then
'Early than win2003 R2
Call LogDebugString("Early than win2003 R2", INFO_LEVEL)
If (CreateSoftwareInstance(SW_OSA_IPMI) > 0) Then
Call LogDebugString("Created OSA IPMI Stack", INFO_LEVEL)
CreateHwMgmtSoftwareInstances = CreateHwMgmtSoftwareInstances + 1
iOSAIPMICreated = 1
End If
ElseIf (StrComp(osVersion, "6.0.0000") < 0 and (IsSoftwareRunning(SW_MS_IPMI) < 0)) Then
'later than win2003 R2 but early than win2008, without Microsoft IPMI enabled
Call LogDebugString("later than win2003 R2 but early than win2008, without Microsoft IPMI enabled", INFO_LEVEL)
If (CreateSoftwareInstance(SW_OSA_IPMI) > 0) Then
Call LogDebugString("Created OSA IPMI Stack", INFO_LEVEL_DETAIL)
CreateHwMgmtSoftwareInstances = CreateHwMgmtSoftwareInstances + 1
iOSAIPMICreated = 1
End If
End If
'Create OSA Mappling Layer
If iOSAIPMICreated = 1 Then
If (CreateSoftwareInstance(SW_IBM_IPMILAYER) > 0) Then
Call LogDebugString("Created OSA Mapping Layer", INFO_LEVEL_DETAIL)
CreateHwMgmtSoftwareInstances = CreateHwMgmtSoftwareInstances + 1
End If
End If
'Create MS IPMI
If ( IsWin2k3r2() and (iOSAIPMICreated = -1)) Then
'later than win2003 R2 but early than win2008, without OSA IPMI
If (CreateSoftwareInstance(SW_MS_IPMI) > 0) Then
Call LogDebugString("Created Microsoft IPMI Stack", INFO_LEVEL_DETAIL)
CreateHwMgmtSoftwareInstances = CreateHwMgmtSoftwareInstances + 1
End If
End If
End If
'Create instance for RSA daemon
If Instr(IsRSAPresented, "None") = 0 Then
If (CreateSoftwareInstance(SW_IBM_RSA) > 0) Then
Call LogDebugString("Created RSA Daemon", INFO_LEVEL)
CreateHwMgmtSoftwareInstances = CreateHwMgmtSoftwareInstances + 1
End If
End If
If IsSoftwareRunning(SW_IBM_DA) > 0 Then ' [d504936/byou: moved it down from far above]
'Create instance for ServeRAID Agent
Dim tempStr
tempStr = "None"
If ServeRAIDPresented(tempStr) > 0 Then
If (CreateSoftwareInstance(SW_IBM_SERVERAID) > 0) Then
Call LogDebugString("Created Lenovo ServeRAID Agent", INFO_LEVEL_DETAIL)
CreateHwMgmtSoftwareInstances = CreateHwMgmtSoftwareInstances + 1
End If
End If
'Create instance for MegaRAID Provider
tempStr = "None"
If MegaRAIDPresented(tempStr) > 0 Then
If (CreateSoftwareInstance(SW_IBM_MEGARAID) > 0) Then
Call LogDebugString("Created Lenovo ServeRAID-MR Provider", INFO_LEVEL)
CreateHwMgmtSoftwareInstances = CreateHwMgmtSoftwareInstances + 1
End If
End If
End If
End Function
Function IsSoftwareRunning(ByVal swID)
Call LogDebugString("Entering IsSoftwareRunning", INFO_LEVEL_FUNCTION)
IsSoftwareRunning = -1
Dim iResult, oSWCollection, swNamespace, swClass, oObjectItem, swServiceName, swName
If swID = SW_IBM_DA Then
swNamespace = CIMV2_NAMESPACE
swClass = SERVICE_CIMV2_CLASS
swServiceName = "wmicimserver"
swName = INTERNAL_ID_IBM_DA ' [d504936/byou: changed]
ElseIf swID = SW_OSA_IPMI Then
swNamespace = CIMV2_NAMESPACE
swClass = DRIVER_CIMV2_CLASS
swServiceName = "IPMI"
swName = INTERNAL_ID_OSA_IPMI ' [d504936/byou: changed]
ElseIf swID = SW_MS_IPMI Then
swNamespace = CIMV2_NAMESPACE
swClass = DRIVER_CIMV2_CLASS
swServiceName = "IPMIDRV"
swName = INTERNAL_ID_MS_IPMI ' [d504936/byou: changed]
End If
'Detect if Director Agent is running or not
iResult = GetWMIObjectCollection(swNamespace, swClass, oSWCollection)
If (iResult > 0) Then
For Each oObjectItem in oSWCollection
'If InStr(oObjectItem.Name, swServiceName) <> 0 Then
If StrComp(Trim(oObjectItem.Name), swServiceName,1) = 0 Then
If Instr(oObjectItem.State, "Running") <> 0 Then
Call LogDebugString(swName + " is running!", INFO_LEVEL_DETAIL)
IsSoftwareRunning = 1
Exit For
End If
End If
Next
End If
If IsSoftwareRunning = -1 Then
Call LogDebugString(swName + " is not running!", INFO_LEVEL)
End If
End Function
Function CreateSoftwareInstance(ByVal swID)
Call LogDebugString("Entering CreateSoftwareInstance()", INFO_LEVEL_FUNCTION)
CreateSoftwareInstance = -1
Dim oHwMgmtSoftwareInstance, oPropertyValue, swName
oFile = "Unknown"
svVersion = "Unknown"
Call LogDebugString("Entering UpdateSoftwareProperty: " + swName, INFO_LEVEL_FUNCTION)
If svServiceName <> "" Then
'Search for the IBM Director Agent WIM CIM Server process
iResult = GetWMIObjectCollection(svNamespace, svClass, oServiceCollection)
If (iResult > 0) Then
If swID = SW_IBM_IPMILAYER Then
For Each oObjectItem in oServiceCollection
oSystemDrive = oObjectItem.SystemDrive
oTargetFile1 = oSystemDrive + "\WINDOWS\system32\ibmsp6w.dll"
oTargetFile2 = oSystemDrive + "\WINDOWS\SysWOW64\ibmsp6w.dll"
Set oFso = CreateObject("Scripting.FileSystemObject")
If oFso.FileExists(oTargetFile1) Then
oFile = oTargetFile1
isvFlag = 1
ElseIf oFso.FileExists(oTargetFile2) Then
oFile = oTargetFile2
isvFlag = 1
End If
If isvFlag > 0 Then
Call LogDebugString("TargetFile:" + oFile, INFO_LEVEL_DETAIL)
Call oHwMgmtSoftwareInstance.AddProperty("$MPElement[Name='IBM.WinSw.HwMgmt']/TargetFile$", CStr(oFile))
If oFso.FileExists(oFile) Then
svVersion = oFso.GetFileVersion(oFile)
Else
svVersion = "Version undetermined - file '" + oFile + "' does not exist!!" ' see "XB047042/byou:" below
End IF
Call LogDebugString("Version:" + svVersion, INFO_LEVEL_DETAIL)
Call oHwMgmtSoftwareInstance.AddProperty("$MPElement[Name='IBM.WinSw.HwMgmt']/Version$", CStr(svVersion))
Exit For
End If
Next
Else
For Each oObjectItem in oServiceCollection
If InStr(oObjectItem.Name, svServiceName) <> 0 Then
Call LogDebugString(svServiceName +" Service Presented", INFO_LEVEL)
isvFlag = 1
svTargetFile = oObjectItem.PathName
If Instr(svTargetFile, """") <> 0 Then
oFile = GetAccurateName(svTargetFile)
Else
oFile = svTargetFile
End If
Call LogDebugString("TargetFile:" + oFile, INFO_LEVEL)
Call oHwMgmtSoftwareInstance.AddProperty("$MPElement[Name='IBM.WinSw.HwMgmt']/TargetFile$", CStr(oFile))
Set oFso = CreateObject("Scripting.FileSystemObject")
' XB047042/byou: x86 RSA-II daemon has the Pathname pointing to %SystemDrive%\system32, but actually
' it gets placed onto %SystemDrive%\SysWOW64 on x64 Windows.
If oFso.FileExists(oFile) Then
svVersion = oFso.GetFileVersion(oFile)
Else
' XB047042/byou: In AddIncompatibleBag(), it will look for "undetermined" in the Version,
' and it will report an error if so.
svVersion = "Version undetermined - file '" + oFile + "' does not exist!!"
End If
Call LogDebugString("Version:" + svVersion, INFO_LEVEL_DETAIL)
Call oHwMgmtSoftwareInstance.AddProperty("$MPElement[Name='IBM.WinSw.HwMgmt']/Version$", CStr(svVersion))
Exit For
End If
Next
End If
End If
End If
If isvFlag = -1 Then
Call LogDebugString(svServiceName + " Service not Presented", WARNING_LEVEL_DEV)
Call oHwMgmtSoftwareInstance.AddProperty("$MPElement[Name='IBM.WinSw.HwMgmt']/TargetFile$", "Unknown")
Call oHwMgmtSoftwareInstance.AddProperty("$MPElement[Name='IBM.WinSw.HwMgmt']/Version$", "Unknown")
End If
End Function