Dell Windows Server Detailed Storage Components Discovery Module

Dell.WindowsServer.Detailed.StorageDiscoveryModule (DataSourceModuleType)

Element properties:

TypeDataSourceModuleType
IsolationAny
AccessibilityInternal
RunAsDefault
OutputTypeSystem.Discovery.Data

Member Modules:

ID Module Type TypeId RunAs 
DS DataSource Microsoft.Windows.TimedScript.DiscoveryProvider Default

Overrideable Parameters:

IDParameterTypeSelectorDisplay NameDescription
IntervalSecondsint$Config/IntervalSeconds$Interval SecondsInterval Seconds
LogLevelint$Config/LogLevel$Log LevelLog Level

Source Code:

<DataSourceModuleType ID="Dell.WindowsServer.Detailed.StorageDiscoveryModule" Accessibility="Internal">
<Configuration>
<xsd:element name="IntervalSeconds" type="xsd:integer"/>
<xsd:element name="Computer" type="xsd:string"/>
<xsd:element name="LogLevel" type="xsd:integer"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalSeconds" ParameterType="int" Selector="$Config/IntervalSeconds$"/>
<OverrideableParameter ID="LogLevel" ParameterType="int" Selector="$Config/LogLevel$"/>
</OverrideableParameters>
<ModuleImplementation>
<Composite>
<MemberModules>
<DataSource ID="DS" TypeID="Windows!Microsoft.Windows.TimedScript.DiscoveryProvider">
<IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
<SyncTime/>
<ScriptName>DellStorageDiscovery.vbs</ScriptName>
<Arguments>$MPElement$ $Target/Id$ $Config/Computer$ $Target/Property[Type="ScalableWindowsServer!Dell.WindowsServer.StorageController"]/DeviceID$ $Config/LogLevel$</Arguments>
<ScriptBody><Script>
'**********************************************************************************
' Script Name - Dell Storage Discovery
' Author: Muralidhar, Vignesh Pandian, Kathiresan.R.S
'
' Description:
' Discover all storage components for a Dell server with instrumentation using OMSS ClI
'
' (c) Copyright &#xA9; 2009&#x2013; 2017 Dell Inc, or its subsidiaries. All Rights Reserved
'**********************************************************************************
Option Explicit
On Error Resume Next
SetLocale("en-us")

Dim oArgs
Set oArgs = WScript.Arguments
if oArgs.Count &lt; 5 Then
Wscript.Quit -1
End If

Dim objLogFSO, objLogTextFile, logMessage, stcontrlID,logLevel, debugLevel
Dim sourceID, managedEntityId, targetComputer

SourceId = oArgs(0)
managedEntityId = oArgs(1)
targetComputer = oArgs(2)
logLevel=oArgs(4)

Dim oAPI, oDiscoveryData, oInst
Dim strComputer, wbemServices, wbemObjectSet
strComputer=targetComputer

stcontrlID = oArgs(3)

Set oAPI = CreateObject("MOM.ScriptAPI")
set oDiscoveryData = oAPI.CreateDiscoveryData(0, SourceId, managedEntityId)

' Begin Logheader
If logLevel &lt;&gt; 0 Then
Dim fileSize, strOutFile
Const strFileName = "Discovery_DellServerStorage.log"
Const ForAppending = 8
Const ForWriting = 2
Const MaxFileSize = 524288 'File Size is limited to 512 KB

dim wsShell : Set wsShell = Createobject("WScript.Shell")
dim wshSysEnv : Set wshSysEnv = wsShell.Environment
dim tFolder : tFolder = wshSysEnv("TEMP")
dim wshPrcEnv : Set wshPrcEnv = wsShell.Environment("Process")
tFolder = Replace(tFolder, "%SystemRoot%", wshPrcEnv("SYSTEMROOT"), 1, -1, vbTextCompare)

Set objLogFSO = CreateObject("Scripting.FileSystemObject")
If Not objLogFSO.FolderExists(tFolder) Then
objLogFSO.CreateFolder(tFolder)
End If
strOutFile = tFolder &amp; "\"&amp; strFileName
If Not objLogFSO.FileExists(strOutFile) Then
Set objLogTextFile = objLogFSO.CreateTextFile(strOutFile)
objLogTextFile.Close()
End If
fileSize = objLogFSO.GetFile(strOutFile).Size
If (fileSize &gt; MaxFileSize) Then
Set objLogTextFile = objLogFSO.OpentextFile(strOutFile, ForWriting, True)
Else
Set objLogTextFile = objLogFSO.OpentextFile(strOutFile, ForAppending, True)
End If
logMessage = "INFO: Script - Dell Server Storage Discovery : Start()"
MOMDebugLog 1, logMessage
Err.Clear
End If

Sub MOMDebugLog (ByVal debugLevel, ByVal Message)
On Error Resume Next
If (debugLevel &gt; 0) and (debugLevel &lt;= logLevel) Then
objLogTextFile.WriteLine(Now() &amp; " ---- " &amp; Message)
Err.Clear
End If
End Sub
' End of Logheader

Const WAIT_LOOP = 1000000
Const SCRIPT_NAME = "Dell Agents State Monitoring"
Const OM_REPORT_STORAGE_CONTR = "Storage"
Const DEF_OMSA_BIN_PATH = "C:\Program Files\Dell\OpenManage\oma\bin"
Const OMSA_REG_INTALL_PATH = "HKEY_LOCAL_MACHINE\SOFTWARE\Dell Computer Corporation\Dell OMA\InstallPath"
Const OMSA64_REG_INTALL_PATH = "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Dell Computer Corporation\Dell OMA\InstallPath"
'Dell Hardware Instrumentation
Dim StorageStatus

Dim s
Set s = New DellStorage
s.DiscoverStorageControllers()
Call oAPI.Return(oDiscoveryData)
logMessage = "INFO : Script - Dell Server Storage Discovery : End()"
MOMDebugLog 1, logMessage
' Close file used for logs
If logLevel &lt;&gt; 0 Then
objLogTextFile.Close
Set objLogTextFile = Nothing
Set objLogFSO = Nothing
End If
Set oDiscoveryData = Nothing
Set oAPI = Nothing

Class DellStorage
Dim arrServerStatus, arrStorageStatus
Dim storageControllerFlag
Dim regError, Message, Message1
Dim a, b

Dim strLine, rc, logMesg
Dim fso, oFile, fileSpec
Dim oShell, WshShell, objStdOut, winTempPath
Dim strCommand, strRepFilePath

Dim parseStartPos, parseEndPos
Dim Index, statusIndex, statusValue
Dim attrFlag, valueFlag, prevStatus, storageStatusValue

Dim omsaBinPath, drive, tempFolder

Function DiscoverStorageControllers()
Dim OMSABinPath ' Store Path from Registry key
Dim drive ' Drive letter
Dim version
regError = 0

' Get OMSA Lib Path
rc = GetOMABinPath(OMSABinPath)
If rc &lt;&gt; 0 Then
Message = "GetOMSAHealth:GetOMABinPath Error"
MOMDebugLog 1, Message
WScript.Quit()
Else
Message = "GetOMSAHealth:OMSABinPath = " &amp; OMSABinPath
MOMDebugLog 1, Message
End If

' Get Install root path
rc = GetOMInstallRoot(drive, OMSABinPath) ' return the current absolute path or the root path for the OMSA Install
If rc &lt;&gt; 0 Then
Message = "GetOMSAHealth:GetOMInstallRoot Error"
MOMDebugLog 1, Message
WScript.Quit()
Else
Message = "GetOMSAHealth:GetOMInstallRoot = " &amp; drive
MOMDebugLog 1, Message
End If
If regError = 1 Then
Message = "Task Fail: OMSA not installed / OMSA Registry Value not found."
MOMDebugLog 1, Message
WScript.Quit()
End If

' Check VBScript engine version
version = CheckVBScriptEngine()
If version = True OR version = False Then ' VIGTBD
GetTempFolderPath winTempPath
storageControllerFlag = 1
DiscoverControllerBattery stcontrlID
DiscoverControllerConnector stcontrlID
DiscoverControllerVirtualDisk stcontrlID
Else
Message = "Error: VBScript corrupted/absent. Please Re-Install Windows Script 5.6 on the Agent"
MOMDebugLog 1, Message
WScript.Quit()
End If
End Function

'*****************************************************************
'GetOMABinPath
'Routine to read the registry to query the OMA Install Path
'*****************************************************************
Function GetOMABinPath(o_sPath)
Dim strOMAKey
Dim oShell, tmp

Set oShell = CreateObject ("WScript.Shell")
o_sPath = ""
On Error Resume Next
o_sPath = oShell.RegRead(OMSA_REG_INTALL_PATH)
If o_sPath = "" Then
o_sPath = oShell.RegRead(OMSA64_REG_INTALL_PATH)
End If
If o_sPath = "" Then
tmp = DEF_OMSA_BIN_PATH &amp; "\omreport.exe"
If(bFileExists(tmp)) Then
o_sPath = DEF_OMSA_BIN_PATH
Message = "GetOMABinPath - OMSABinPath is empty, Using Default Existing Path" &amp; DEF_OMSA_BIN_PATH
MOMDebugLog 1, Message
Else
regError = 1
End If
Else
o_sPath = o_sPath &amp; "\bin"
End If

omsaBinPath = o_sPath

If Err &lt;&gt; 0 Then
GetOMSABinPath = Err.Number
End If
On Error Goto 0
End Function

'*****************************************************************
'GetOMInstallRoot
'Routine to determine the Drive letter where OMSA is installed
'*****************************************************************
Private Function GetOMInstallRoot(ByRef path, ByVal OMSAInstallPath)
On Error Resume Next
Err.Clear
' Return the root drive of the OMInstall Path
path = Left(OMSAInstallPath, 2)
drive = path
On Error Goto 0
End Function

'*****************************************************************
'bFileExists
'Routine to determine if the OMSA Report file is created
'*****************************************************************
Function bFileExists(filespec1)
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
bFileExists = (fso.FileExists(filespec1))
Set fso = Nothing
End Function

'*****************************************************************
'DelFile
'Routine to delete the OMSA Report file
'*****************************************************************
Function DelFile(ByVal filespec2)
Dim fso, oFile
If bFileExists(filespec2) Then
Set fso = CreateObject("Scripting.FileSystemObject")
fso.DeleteFile filespec2, True
Set fso = Nothing
End If
If Err &lt;&gt; 0 Then
DelFile = Err.Number
End If
End Function

'**********************************************************
' CheckVBScriptEngine()
' Check VBScript engine version:
'**********************************************************
Function CheckVBScriptEngine()
On Error Resume Next
Dim bIsCompatV, var
Const VBSCRIPT_MIN_VERSION = 56
var = ((ScriptEngineMajorVersion * 10) + ScriptEngineMinorVersion)
If ((var) &lt; VBSCRIPT_MIN_VERSION) Then
bIsCompatV = False
Else
bIsCompatV = True
End If
If Err &lt;&gt; 0 Then
CheckVBScriptEngine = Err.Number
Err.Clear
Else
CheckVBScriptEngine = bIsCompatV
End If
End Function

'*****************************************************************
'GetTempFolderPath
'Routine to Get Win Temp Folder path
'*****************************************************************
Function GetTempFolderPath(ByRef WinTempFolder)
Dim fldrExistFlag, fso
fldrExistFlag = False
dim wshShell : Set wshShell = Createobject("WScript.Shell")
dim wshSysEnv : Set wshSysEnv = wshShell.Environment
dim strSysTempFolder : strSysTempFolder = wshSysEnv("TEMP")
dim wshPrcEnv : Set wshPrcEnv = wshShell.Environment("Process")
strSysTempFolder = Replace(strSysTempFolder, "%SystemRoot%", wshPrcEnv("SYSTEMROOT"), 1, -1, vbTextCompare)
WinTempFolder = strSysTempFolder

Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FolderExists(WinTempFolder)) Then
fldrExistFlag = True
Else
fldrExistFlag = False
End If

tempFolder = WinTempFolder

Set wshShell = Nothing
Set wshSysEnv = Nothing
Set strSysTempFolder = Nothing
Set wshPrcEnv = Nothing

If Err &lt;&gt; 0 Then
GetTempFolderPath = Err.Number
End If
End Function

Function DiscoverControllerBattery (ByVal controllerID)
'On Error Resume Next
Dim filePath, command, fileSpec, x, y, oShell, result
Dim xmlDoc, i, obj
x = 1
y = 0

filePath = tempFolder &amp; "\" &amp; OM_REPORT_STORAGE_CONTR &amp; "controller_" &amp; controllerID &amp; "_battery.xml"
command = "cmd /C " &amp; chr(34) &amp; omsaBinPath &amp; "\" &amp; "omreport.exe" &amp; Chr(34) &amp; " storage battery controller=" &amp; controllerID &amp; " -fmt xml -outc " &amp; filePath

Message = "DiscoverControllerBattery : Executed omreport storage battery controller=" &amp; controllerID &amp; " -fmt xml -outc " &amp; filePath
MOMDebugLog 1, Message

fileSpec = filePath
Set oShell = CreateObject ("WScript.Shell")
result = oShell.run (command,0,true)


If result &lt;&gt; 0 Then
DelFile(filePath)
Else
' Infinite Loop Until file OM_REPORT_FILE_NAME is created
Do While bFileExists(fileSpec) &lt;&gt; -1
WScript.Sleep(0)
x = x + 1
y = x Mod WAIT_LOOP

If y = 0 Then
MOMDebugLog 1, "Exit RunCmd. Reason: OMREPORT STORAGE not responding for " &amp; WAIT_LOOP &amp; " loops."
Exit Do
End If
Loop
If(bFileExists(fileSpec)) Then
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
If (IsObject(xmlDoc) = True) Then
xmlDoc.async = "false"
xmlDoc.load(fileSpec)
If (xmlDoc.parseError.errorCode &lt;&gt; 0) Then
Dim myErr
Set myErr = xmlDoc.parseError
Message = "XML Parse Error Reason: " &amp; myErr.reason
MOMDebugLog 1, Message
Message = "XML Parse Error Line: " &amp; myErr.line
MOMDebugLog 1, Message
Message = "XML Parse Error Character: " &amp; myErr.linepos
MOMDebugLog 1, Message
Message = "XML Parse Error Text: " &amp; myErr.srcText
MOMDebugLog 1, Message
DelFile(fileSpec)
Exit Function
End If

Set obj = xmlDoc.getElementsByTagName("BatteryID")
If (obj.length &gt; 0) Then
Message = "DiscoverControllerBattery : Parsing storage controller Battery(Sensor) data of controller " &amp; controllerID
MOMDebugLog 1, Message
set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Dell.WindowsServer.ControllerSensors']$")
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", targetComputer)
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.LogicalDevice']/DeviceID$", targetComputer)
call oInst.AddProperty("$MPElement[Name='ScalableWindowsServer!Dell.WindowsServer.StorageController']/DeviceID$", controllerID)
call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "Controller Sensors")
Message = "DiscoverControllerBattery : Submitting the data of controller Battery(Sensor) " &amp; controllerID
MOMDebugLog 1, Message
call oDiscoveryData.AddInstance(oInst)

Else
Message = "Empty return for Storage controller sensors. Not creating object"
MOMDebugLog 1, Message
End If
Else
Message = "Error: DOM object not created using CreateObject - Microsoft.XMLDOM"
MOMDebugLog 1, Message
End If
Else
Message = "Storage CLI XML Output File does not exist - " &amp; fileSpec
MOMDebugLog 1, Message
End If

' Clean up the CLI Output : Delete OM_REPORT_FILE_NAME for STORAGE
DelFile(filePath)
End If ' End of If Condition for rc&lt;&gt;0 for oshell.run(omreport storage controller)
Set filePath = Nothing
Set command = Nothing
Set oShell = Nothing
Set fileSpec = Nothing
End Function

Function DiscoverControllerVirtualDisk (ByVal controllerID)
'On Error Resume Next
Dim filePath, command, fileSpec, x, y, oShell, result
Dim busProtocolType,xmlDoc, i
Dim vdLayout, vdLayoutVal, vdSize, vdSizeVal, deviceName, deviceNameVal, protocolType, protocolTypeVal
Dim readPolicy, readPolicyVal, vdName, vdNameVal,deviceIdVal,sizeInGb,vDiskLayout
Dim writePolicy, writePolicyVal, cachePolicy, cachePolicyVal, stripeSize, stripeSizeVal
Dim vdReadPolicy,vdWritePolicy,vdCachePolicy,vdStripeSize,nexus,nexusVal,devId
const ONEGB = 1073741824
x = 1
y = 0

filePath = tempFolder &amp; "\" &amp; OM_REPORT_STORAGE_CONTR &amp; "controller_" &amp; controllerID &amp; "_vdisk.xml"
command = "cmd /C " &amp; chr(34) &amp; omsaBinPath &amp; "\" &amp; "omreport.exe" &amp; Chr(34) &amp; " storage vdisk controller=" &amp; controllerID &amp; " -fmt xml -outc " &amp; filePath

Message = "DiscoverControllerVirtualDisk : Executed omreport storage vdisk controller=" &amp; controllerID &amp; " -fmt xml -outc " &amp; filePath
MOMDebugLog 1, Message

fileSpec = filePath
Set oShell = CreateObject ("WScript.Shell")
result = oShell.run (command,0,true)

If result &lt;&gt; 0 Then
DelFile(filePath)
Else
' Infinite Loop Until file OM_REPORT_FILE_NAME is created
Do While bFileExists(fileSpec) &lt;&gt; -1
WScript.Sleep(0)
x = x + 1
y = x Mod WAIT_LOOP

If y = 0 Then
'MOMDebugLog "Exit RunCmd. Reason: OMREPORT STORAGE not responding for " &amp; WAIT_LOOP &amp; " loops."
Exit Do
End If
Loop

If(bFileExists(fileSpec)) Then
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
If (IsObject(xmlDoc) = True) Then
xmlDoc.async = "false"
xmlDoc.load(fileSpec)
If (xmlDoc.parseError.errorCode &lt;&gt; 0) Then
Dim myErr
Set myErr = xmlDoc.parseError
Message = "XML Parse Error Reason: " &amp; myErr.reason
MOMDebugLog 1, Message
Message = "XML Parse Error Line: " &amp; myErr.line
MOMDebugLog 1, Message
Message = "XML Parse Error Character: " &amp; myErr.linepos
MOMDebugLog 1, Message
Message = "XML Parse Error Text: " &amp; myErr.srcText
MOMDebugLog 1, Message
DelFile(fileSpec)
End If

Set vdName = xmlDoc.getElementsByTagName("Name")
Set deviceName = xmlDoc.getElementsByTagName("DeviceName")
Set vdLayout = xmlDoc.getElementsByTagName("Layout")
Set vdSize = xmlDoc.getElementsByTagName("Length")
Set protocolType= xmlDoc.getElementsByTagName("BusProtocol")
Set stripeSize = xmlDoc.getElementsByTagName("StripeSize")
Set readPolicy = xmlDoc.getElementsByTagName("ReadPolicy")
Set writePolicy = xmlDoc.getElementsByTagName("WritePolicy")
Set cachePolicy = xmlDoc.getElementsByTagName("DiskCachePolicy")
Set nexus = xmlDoc.getElementsByTagName("Nexus")

For i = 0 To (vdName.length - 1)
vdNameVal = vdName.Item(i).nodeTypedValue
If nexus Is Nothing Or nexus.Item(i) Is Nothing Then
deviceIdVal = "Not Applicable"
Else
nexusVal = nexus.Item(i).nodeTypedValue
devId = Split(nexusVal,"\",-1)
deviceIdVal = devId(2)
End If
If deviceName Is Nothing Or deviceName.Item(i) Is Nothing Then
deviceNameVal = "Not Applicable"
Else
deviceNameVal = deviceName.Item(i).nodeTypedValue
End If
If vdLayout Is Nothing Or vdLayout.Item(i) Is Nothing Then
vdLayoutVal = ""
Else
vdLayoutVal = vdLayout.Item(i).nodeTypedValue
End If
If vdSize Is Nothing Or vdSize.Item(i) Is Nothing Then
vdSizeVal = "Not Applicable"
Else
vdSizeVal = vdSize.Item(i).nodeTypedValue
sizeInGb = vdSizeVal / ONEGB
sizeInGb = sizeInGb &amp; " GB" &amp; " (" &amp; vdSizeVal &amp; " bytes)"
End If
If protocolType Is Nothing Or protocolType.Item(i) Is Nothing Then
protocolTypeVal = ""
Else
protocolTypeVal = protocolType.Item(i).nodeTypedValue
End If
If readPolicy Is Nothing Or readPolicy.Item(i) Is Nothing Then
readPolicyVal = ""
Else
readPolicyVal = readPolicy.Item(i).nodeTypedValue
End If
If writePolicy Is Nothing Or writePolicy.Item(i) Is Nothing Then
writePolicyVal = ""
Else
writePolicyVal = writePolicy.Item(i).nodeTypedValue
End If
If cachePolicy Is Nothing Or cachePolicy.Item(i) Is Nothing Then
cachePolicyVal = ""
Else
cachePolicyVal = cachePolicy.Item(i).nodeTypedValue
End If
If stripeSize Is Nothing Or stripeSize.Item(i) Is Nothing Then
stripeSizeVal = ""
Else
stripeSizeVal = stripeSize.Item(i).nodeTypedValue
End If

If ( StrComp(vdLayoutVal,"")&lt;&gt;0) Then
If ( StrComp(vdLayoutVal,"1")=0) Then
vDiskLayout = "Concatenated"
ElseIf ( StrComp(vdLayoutVal,"2")=0) Then
vDiskLayout = "RAID-0"
ElseIf ( StrComp(vdLayoutVal,"4")=0) Then
vDiskLayout = "RAID-1"
ElseIf ( StrComp(vdLayoutVal,"64")=0) Then
vDiskLayout = "RAID-5"
ElseIf ( StrComp(vdLayoutVal,"128")=0) Then
vDiskLayout = "RAID-6"
ElseIf ( StrComp(vdLayoutVal,"512")=0) Then
vDiskLayout = "RAID-10"
ElseIf ( StrComp(vdLayoutVal,"1024")=0) Then
vDiskLayout = "RAID-30"
ElseIf ( StrComp(vdLayoutVal,"2048")=0) Then
vDiskLayout = "RAID-50"
ElseIf ( StrComp(vdLayoutVal,"262144")=0) Then
vDiskLayout = "RAID-60"
ElseIf ( StrComp(vdLayoutVal,"4096")=0) Then
vDiskLayout = "RAID-1 Concatenated"
ElseIf ( StrComp(vdLayoutVal,"8192")=0) Then
vDiskLayout = "RAID-5 Concatenated"
ElseIf ( StrComp(vdLayoutVal,"16384")=0) Then
vDiskLayout = "No RAID"
ElseIf ( StrComp(vdLayoutVal,"32768")=0) Then
vDiskLayout = "Volume"
Else
vDiskLayout = "Not Applicable"
End If
Else
vDiskLayout = "Not Applicable"
End If

If ( StrComp(protocolTypeVal,"")&lt;&gt;0) Then
If ( StrComp ( protocolTypeVal,"1")=0) Then
busProtocolType = "SCSI"
ElseIf ( StrComp ( protocolTypeVal,"2")=0) Then
busProtocolType = "IDE"
ElseIf ( StrComp ( protocolTypeVal,"7")=0) Then
busProtocolType = "SATA"
ElseIf ( StrComp ( protocolTypeVal,"8")=0) Then
busProtocolType = "SAS"
ElseIf ( StrComp ( protocolTypeVal,"9")=0) Then
busProtocolType = "PCIe"
ElseIf ( StrComp ( protocolTypeVal,"15")=0) Then
busProtocolType = "SAS,SATA"
Else
busProtocolType = "Not Applicable"
End If
Else
busProtocolType = "Not Applicable"
End If

If ( StrComp(readPolicyVal,"")&lt;&gt;0) Then
If ( StrComp ( readPolicyVal,"1")=0) Then
vdReadPolicy = "Read Cache Enabled"
ElseIf ( StrComp ( readPolicyVal,"2")=0) Then
vdReadPolicy = "Read Cache Disabled"
ElseIf ( StrComp ( readPolicyVal,"4")=0) Then
vdReadPolicy = "Read Ahead"
ElseIf ( StrComp ( readPolicyVal,"8")=0) Then
vdReadPolicy = "Adaptive Read Ahead"
ElseIf ( StrComp ( readPolicyVal,"16")=0) Then
vdReadPolicy = "No Read Ahead"
Else
vdReadPolicy = "Not Applicable"
End If
Else
vdReadPolicy = "Not Applicable"
End If

If ( StrComp(writePolicyVal,"")&lt;&gt;0) Then
If ( StrComp ( writePolicyVal,"1")=0) Then
vdWritePolicy = "Write Cache Enabled Protected"
ElseIf ( StrComp ( writePolicyVal,"2")=0) Then
vdWritePolicy = "Write Cache Disabled"
ElseIf ( StrComp ( writePolicyVal,"4")=0) Then
vdWritePolicy = "Write Back"
ElseIf ( StrComp ( writePolicyVal,"8")=0) Then
vdWritePolicy = "Write Through"
ElseIf ( StrComp ( writePolicyVal,"16")=0) Then
vdWritePolicy = "Write Cache Enable Always"
ElseIf ( StrComp ( writePolicyVal,"32")=0) Then
vdWritePolicy = "Force Write Back"
Else
vdWritePolicy = "Not Applicable"
End If
Else
vdWritePolicy = "Not Applicable"
End If

If ( StrComp(cachePolicyVal,"")&lt;&gt;0) Then
If ( StrComp ( cachePolicyVal,"2")=0) Then
vdCachePolicy = "Enabled"
ElseIf ( StrComp ( cachePolicyVal,"4")=0) Then
vdCachePolicy = "Disabled"
ElseIf ( StrComp ( cachePolicyVal,"1")=0) Then
vdCachePolicy = "Unchanged"
Else
vdCachePolicy = "Not Applicable"
End If
Else
vdCachePolicy = "Not Available"
End If

If ( StrComp(stripeSizeVal,"")&lt;&gt;0) Then
If ( StrComp ( stripeSizeVal,"0")=0) Then
vdStripeSize = "Not Applicable"
ElseIf ( StrComp ( stripeSizeVal,"1")=0) Then
vdStripeSize = "512 Bytes"
ElseIf ( StrComp ( stripeSizeVal,"2")=0) Then
vdStripeSize = "1 KB"
ElseIf ( StrComp ( stripeSizeVal,"4")=0) Then
vdStripeSize = "2 KB"
ElseIf ( StrComp ( stripeSizeVal,"8")=0) Then
vdStripeSize = "4 KB"
ElseIf ( StrComp ( stripeSizeVal,"16")=0) Then
vdStripeSize = "8 KB"
ElseIf ( StrComp ( stripeSizeVal,"32")=0) Then
vdStripeSize = "16 KB"
ElseIf ( StrComp ( stripeSizeVal,"64")=0) Then
vdStripeSize = "32 KB"
ElseIf ( StrComp ( stripeSizeVal,"128")=0) Then
vdStripeSize = "64 KB"
ElseIf ( StrComp ( stripeSizeVal,"256")=0) Then
vdStripeSize = "128 KB"
ElseIf ( StrComp ( stripeSizeVal,"512")=0) Then
vdStripeSize = "256 KB"
ElseIf ( StrComp ( stripeSizeVal,"1024")=0) Then
vdStripeSize = "512 KB"
ElseIf ( StrComp ( stripeSizeVal,"2048")=0) Then
vdStripeSize = "1 MB"
ElseIf ( StrComp ( stripeSizeVal,"4096")=0) Then
vdStripeSize = "2 MB"
ElseIf ( StrComp ( stripeSizeVal,"8192")=0) Then
vdStripeSize = "4 MB"
ElseIf ( StrComp ( stripeSizeVal,"16384")=0) Then
vdStripeSize = "8 MB"
ElseIf ( StrComp ( stripeSizeVal,"32768")=0) Then
vdStripeSize = "16 MB"
Else
vdStripeSize = "Not Applicable"
End If
Else
vdStripeSize = "Not Applicable"
End If

If i = 0 Then
Message = "DiscoverControllerVirtualDisk : Creating Virtual Disk Group"
MOMDebugLog 1, Message
set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Dell.WindowsServer.ControllerVirtualDiskGroup']$")
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", targetComputer)
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.LogicalDevice']/DeviceID$", targetComputer)
call oInst.AddProperty("$MPElement[Name='ScalableWindowsServer!Dell.WindowsServer.StorageController']/DeviceID$", controllerID)
call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "Virtual Disk Group")
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerVirtualDiskGroup']/Number$", controllerID)

Message = "DiscoverControllerVirtualDisk : Submitting Virtual Disk Group data"
MOMDebugLog 1, Message
call oDiscoveryData.AddInstance(oInst)

End If

Message = "DiscoverControllerVirtualDisk : Parsing storage controller Vdisk data of controller " &amp; controllerID &amp; " with display name " &amp; vdNameVal
MOMDebugLog 1, Message

set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Dell.WindowsServer.ControllerVirtualDisk']$")
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", targetComputer)
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.LogicalDevice']/DeviceID$", targetComputer)
call oInst.AddProperty("$MPElement[Name='ScalableWindowsServer!Dell.WindowsServer.StorageController']/DeviceID$", controllerID)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerVirtualDiskGroup']/Number$", controllerID)
call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", vdNameVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerVirtualDisk']/ID$", deviceIdVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerVirtualDisk']/Layout$", vDiskLayout)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerVirtualDisk']/Size$", sizeInGb)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerVirtualDisk']/DeviceName$", deviceNameVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerVirtualDisk']/Type$", busProtocolType)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerVirtualDisk']/ReadPolicy$", vdReadPolicy)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerVirtualDisk']/WritePolicy$", vdWritePolicy)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerVirtualDisk']/CachePolicy$", vdCachePolicy)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerVirtualDisk']/StripeElementSize$", vdStripeSize)

Message = "DiscoverControllerVirtualDisk : Submitting the data of controller Vdisk " &amp; controllerID &amp; " with display name " &amp; vdNameVal
MOMDebugLog 1, Message
call oDiscoveryData.AddInstance(oInst)

Next
Else
Message = "Error: DOM object not created using CreateObject - Microsoft.XMLDOM"
MOMDebugLog 1, Message
End If
Else
Message = "Storage CLI XML Output File does not exist - " &amp; fileSpec
MOMDebugLog 1, Message
End If

' Clean up the CLI Output : Delete OM_REPORT_FILE_NAME for STORAGE
DelFile(filePath)
End If ' End of If Condition for rc&lt;&gt;0 for oshell.run(omreport storage controller)
Set filePath = Nothing
Set command = Nothing
Set oShell = Nothing
Set fileSpec = Nothing
End Function

Function DiscoverControllerConnector (ByVal controllerID)

Dim filePath, command, fileSpec, x, y, oShell, result
Dim channel,channelVal,xmlDoc, i,busProtocol,busProtocolVal,termination,terminationVal,scsiRate,scsiRateVal
Dim attribMask,attribMaskVal, connectorBusProtocol,connectorTermination,displayName, logicalConnectorFlag
const ATTRIBMASKBIT23 = 23
const ATTRIBMASKBIT26 = 26
logicalConnectorFlag = 0
x = 1
y = 0

filePath = tempFolder &amp; "\" &amp; OM_REPORT_STORAGE_CONTR &amp; "controller_" &amp; controllerID &amp; "_connector.xml"
command = "cmd /C " &amp; chr(34) &amp; omsaBinPath &amp; "\" &amp; "omreport.exe" &amp; Chr(34) &amp; " storage connector controller=" &amp; controllerID &amp; " -fmt xml -outc " &amp; filePath

Message = "DiscoverControllerConnector : Executed omreport storage connector controller=" &amp; controllerID &amp; " -fmt xml -outc " &amp; filePath
MOMDebugLog 1, Message

fileSpec = filePath
Set oShell = CreateObject ("WScript.Shell")
result = oShell.run (command,0,true)

If result &lt;&gt; 0 Then
DelFile(filePath)
Else
' Infinite Loop Until file OM_REPORT_FILE_NAME is created
Do While bFileExists(fileSpec) &lt;&gt; -1
WScript.Sleep(0)
x = x + 1
y = x Mod WAIT_LOOP

If y = 0 Then
MOMDebugLog 1, "Exit RunCmd. Reason: OMREPORT STORAGE not responding for " &amp; WAIT_LOOP &amp; " loops."
Exit Do
End If
Loop

If(bFileExists(fileSpec)) Then
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
If (IsObject(xmlDoc) = True) Then
xmlDoc.async = "false"
xmlDoc.load(fileSpec)
If (xmlDoc.parseError.errorCode &lt;&gt; 0) Then
Dim myErr
Set myErr = xmlDoc.parseError
Message = "XML Parse Error Reason: " &amp; myErr.reason
MOMDebugLog 1, Message
Message = "XML Parse Error Line: " &amp; myErr.line
MOMDebugLog 1, Message
Message = "XML Parse Error Character: " &amp; myErr.linepos
MOMDebugLog 1, Message
Message = "XML Parse Error Text: " &amp; myErr.srcText
MOMDebugLog 1, Message
DelFile(fileSpec)
Exit Function
End If

Set channel = xmlDoc.getElementsByTagName("Channel")
Set busProtocol = xmlDoc.getElementsByTagName("BusProtocol")
Set termination = xmlDoc.getElementsByTagName("Termination")
Set scsiRate = xmlDoc.getElementsByTagName("SCSIRate")
Set attribMask = xmlDoc.getElementsByTagName("AttributesMask")

For i = 0 To (channel.length - 1)
If (logicalConnectorFlag = 1) Then
Exit For
End If

channelVal = channel.Item(i).nodeTypedValue

If busProtocol Is Nothing Or busProtocol.Item(i) Is Nothing Then
busProtocolVal = ""
Else
busProtocolVal = busProtocol.Item(i).nodeTypedValue
End If
If termination Is Nothing Or termination.Item(i) Is Nothing Then
terminationVal = ""
Else
terminationVal = termination.Item(i).nodeTypedValue
End If
If scsiRate Is Nothing Or scsiRate.Item(i) Is Nothing Then
scsiRateVal = "Not Applicable"
Else
scsiRateVal = scsiRate.Item(i).nodeTypedValue
End If
If attribMask Is Nothing Or attribMask.Item(i) Is Nothing Then
attribMaskVal = ""
Else
attribMaskVal = attribMask.Item(i).nodeTypedValue
End If


If ( StrComp(attribMaskVal,"")&lt;&gt;0) Then
If (Mid(attribMaskVal,ATTRIBMASKBIT26,1) = "1" ) Then
logicalConnectorFlag = 1
displayName = "Logical Connector " &amp; channelVal
Else
If ( StrComp(busProtocolVal,"9")=0) Then
displayName = "PCIe-SSD Extender"
Else
displayName = "Connector " &amp; channelVal
End If
End If
End If

If ( StrComp(busProtocolVal,"")&lt;&gt;0) Then
If ( StrComp(busProtocolVal,"1")=0) Then
If( Mid(attribMaskVal,ATTRIBMASKBIT23,1) = "0" ) Then
connectorBusProtocol = "SCSI Channel RAID Mode"
Else
connectorBusProtocol = "SCSI Channel Non-RAID Mode"
End If
ElseIf ( StrComp(busProtocolVal,"7")=0) Then
connectorBusProtocol = "SATA Port RAID Mode"
ElseIf ( StrComp(busProtocolVal,"2")=0) Then
connectorBusProtocol = "IDE Channel RAID Mode"
ElseIf ( StrComp(busProtocolVal,"8")=0) Then
If( Mid(attribMaskVal,ATTRIBMASKBIT23,1) = "0" ) Then
connectorBusProtocol = "SAS Port RAID Mode"
Else
connectorBusProtocol = "SAS Port Non-RAID Mode"
End If
ElseIf ( StrComp(busProtocolVal,"9")=0) Then
connectorBusProtocol = "PCIe"
Else
connectorBusProtocol = "Not Applicable"
End If
Else
connectorBusProtocol = "Not Applicable"
End If

If ( StrComp(terminationVal,"")&lt;&gt;0) Then
If ( StrComp(terminationVal,"1")=0) Then
connectorTermination = "Wide Terminated"
ElseIf ( StrComp(terminationVal,"2")=0) Then
connectorTermination = "Narrow Terminated"
ElseIf ( StrComp(terminationVal,"3")=0) Then
connectorTermination = "Not Terminated"
Else
connectorTermination = "Not Applicable"
End If
Else
connectorTermination = "Not Applicable"
End If
Message = "DiscoverControllerConnector : Parsing storage controller connector data of controller " &amp; controllerID &amp; " with displayName " &amp; displayName
MOMDebugLog 1, Message
set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Dell.WindowsServer.ControllerConnector']$")
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", targetComputer)
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.LogicalDevice']/DeviceID$", targetComputer)
call oInst.AddProperty("$MPElement[Name='ScalableWindowsServer!Dell.WindowsServer.StorageController']/DeviceID$", controllerID)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerConnector']/ID$", channelVal)
call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", displayName)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerConnector']/ConnectorType$", connectorBusProtocol)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerConnector']/Termination$", connectorTermination)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerConnector']/SCSIRate$", scsiRateVal)

Message = "DiscoverControllerConnector : Submitting the data of controller connector " &amp; controllerID &amp; " with display name " &amp; displayName
MOMDebugLog 1, Message
call oDiscoveryData.AddInstance(oInst)

Message = "DiscoverControllerConnector : Invoking Controller Enclosure discovery of controller " &amp; controllerID &amp; " with connector id " &amp; channelVal
MOMDebugLog 1, Message
DiscoverEnclosure controllerID, channelVal, busProtocolVal
Message = "DiscoverControllerConnector : Invoking Connector Physical Disk discovery of controller " &amp; controllerID &amp; " with connector id " &amp; channelVal
MOMDebugLog 1, Message
DiscoverConnectorPhysicalDisk controllerID, channelVal
Next
Else
Message = "Error: DOM object not created using CreateObject - Microsoft.XMLDOM"
MOMDebugLog 1, Message
End If
Else
Message = "Storage CLI XML Output File does not exist - " &amp; fileSpec
MOMDebugLog 1, Message
End If
' Clean up the CLI Output : Delete OM_REPORT_FILE_NAME for STORAGE
DelFile(filePath)
End If ' End of If Condition for rc&lt;&gt;0 for oshell.run(omreport storage controller)
Set filePath = Nothing
Set command = Nothing
Set oShell = Nothing
Set fileSpec = Nothing
'MOMDebugLog "End of Connector Discoevr function"
End Function

Function DiscoverEnclosure (ByVal controllerID, ByVal connectorID, ByVal protocolType)
'MOMDebugLog ("BeginEnclDiscover")
Dim filePath, command, fileSpec, x, y, oShell, result, enclSensorFlag
Dim enclosureId,enclId,enclIdVal,firmwareVer,firmwareVerVal,channel,channelVal,displayName,displayNameVal
Dim svcTag,svcTagVal,assetTag,assetTagVal,sasAddress,sasAddressVal,enclCfgVal,enclCfg,enclosureConfig,assetName,assetNameVal
Dim backPlanePartNo,backPlanePartNoVal, splitBusPartNo, splitBusPartNoVal,enclPartNo,enclPartNoVal,targetId,targetIdVal
Dim xmlDoc,i
x = 1
y = 0
enclSensorFlag = 0

filePath = tempFolder &amp; "\" &amp; OM_REPORT_STORAGE_CONTR &amp; "controller_" &amp; controllerID &amp; "_enclosure.xml"
command = "cmd /C " &amp; chr(34) &amp; omsaBinPath &amp; "\" &amp; "omreport.exe" &amp; Chr(34) &amp; " storage enclosure controller=" &amp; controllerID &amp; " -fmt xml -outc " &amp; filePath
Message = "DiscoverEnclosure : Executed omreport storage enclsoure controller=" &amp; controllerID &amp; " -fmt xml -outc " &amp; filePath
MOMDebugLog 1, Message
fileSpec = filePath
Set oShell = CreateObject ("WScript.Shell")
result = oShell.run (command,0,true)

If result &lt;&gt; 0 Then
DelFile(filePath)
Else
' Infinite Loop Until file OM_REPORT_FILE_NAME is created
Do While bFileExists(fileSpec) &lt;&gt; -1
WScript.Sleep(0)
x = x + 1
y = x Mod WAIT_LOOP

If y = 0 Then
'MOMDebugLog "Exit RunCmd. Reason: OMREPORT STORAGE not responding for " &amp; WAIT_LOOP &amp; " loops."
Exit Do
End If
Loop

If(bFileExists(fileSpec)) Then
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
If (IsObject(xmlDoc) = True) Then
xmlDoc.async = "false"
xmlDoc.load(fileSpec)
If (xmlDoc.parseError.errorCode &lt;&gt; 0) Then
Dim myErr
Set myErr = xmlDoc.parseError
Message = "XML Parse Error Reason: " &amp; myErr.reason
MOMDebugLog 1, Message
Message = "XML Parse Error Line: " &amp; myErr.line
MOMDebugLog 1, Message
Message = "XML Parse Error Character: " &amp; myErr.linepos
MOMDebugLog 1, Message
Message = "XML Parse Error Text: " &amp; myErr.srcText
MOMDebugLog 1, Message
DelFile(fileSpec)
Exit Function
End If

Set enclId = xmlDoc.getElementsByTagName("EnclosureID")
Set firmwareVer = xmlDoc.getElementsByTagName("FirmwareVer")
Set channel = xmlDoc.getElementsByTagName("Channel")
set displayName = xmlDoc.getElementsByTagName("ProductID")
Set svcTag = xmlDoc.getElementsByTagName("ServiceTag")
Set sasAddress = xmlDoc.getElementsByTagName("SASAddress")
Set assetName = xmlDoc.getElementsByTagName("AssetName")
Set assetTag = xmlDoc.getElementsByTagName("AssetTag")
Set backPlanePartNo = xmlDoc.getElementsByTagName("BackPlanePartNum")
Set splitBusPartNo = xmlDoc.getElementsByTagName("SplitBusPartNum")
Set enclPartNo = xmlDoc.getElementsByTagName("EnclosurePartNum")
Set targetId = xmlDoc.getElementsByTagName("TargetID")
Set enclCfg = xmlDoc.getElementsByTagName("EnclosureConfig")


For i = 0 To (enclId.length -1)
enclIdVal = enclId.Item(i).nodeTypedValue

If firmwareVer Is Nothing Or firmwareVer.Item(i) Is Nothing Then
firmwareVerVal = "Not Applicable"
Else
firmwareVerVal = firmwareVer.Item(i).nodeTypedValue
End If
If channel Is Nothing Or channel.Item(i) Is Nothing Then
channelVal = "Not Applicable"
Else
channelVal = channel.Item(i).nodeTypedValue
End If
If displayName Is Nothing Or displayName.Item(i) Is Nothing Then
displayNameVal = "ENCL " &amp; enclIdVal
Else
displayNameVal = displayName.Item(i).nodeTypedValue
End If
If svcTag Is Nothing Or svcTag.Item(i) Is Nothing Then
svcTagVal = "Not Applicable"
Else
svcTagVal = svcTag.Item(i).nodeTypedValue
End If
If sasAddress Is Nothing Or sasAddress.Item(i) Is Nothing Then
sasAddressVal = "Not Applicable"
Else
sasAddressVal = sasAddress.Item(i).nodeTypedValue
End If
If assetName Is Nothing Or assetName.Item(i) Is Nothing Then
assetNameVal = "Not Applicable"
Else
assetNameVal = assetName.Item(i).nodeTypedValue
End If
If assetTag Is Nothing Or assetTag.Item(i) Is Nothing Then
assetTagVal = "Not Applicable"
Else
assetTagVal = assetTag.Item(i).nodeTypedValue
End If
If backPlanePartNo Is Nothing Or backPlanePartNo.Item(i) Is Nothing Then
backPlanePartNoVal = "Not Applicable"
Else
backPlanePartNoVal = backPlanePartNo.Item(i).nodeTypedValue
End If
If splitBusPartNo Is Nothing Or splitBusPartNo.Item(i) Is Nothing Then
splitBusPartNoVal = "Not Applicable"
Else
splitBusPartNoVal = splitBusPartNo.Item(i).nodeTypedValue
End If
If targetId Is Nothing Or targetId.Item(i) Is Nothing Then
targetIdVal = "Not Applicable"
Else
targetIdVal = targetId.Item(i).nodeTypedValue
End If
If enclPartNo Is Nothing Or enclPartNo.Item(i) Is Nothing Then
enclPartNoVal = "Not Applicable"
Else
enclPartNoVal = enclPartNo.Item(i).nodeTypedValue
End If
If enclCfg Is Nothing Or enclCfg.Item(i) Is Nothing Then
enclCfgVal = "Not Applicable"
Else
enclCfgVal = enclCfg.Item(i).nodeTypedValue
End If

'DF327052 If the protocolType is SCSI use enclosureID, For SAS,SATA and SAS,SATA use channelID:enclosureID
If ( StrComp(protocolType,"1")=0) Then
enclosureId = channelVal
Else
enclosureId = channelVal &amp; ":" &amp; enclIdVal
End If


If ( StrComp(enclCfgVal,"")&lt;&gt;0) Then
If ( StrComp(enclCfgVal,"1")=0) Then
enclosureConfig = "Joined"
ElseIf ( StrComp(enclCfgVal,"2")=0) Then
enclosureConfig = "Split"
ElseIf ( StrComp(enclCfgVal,"3")=0) Then
enclosureConfig = "Clustered"
ElseIf ( StrComp(enclCfgVal,"4")=0) Then
enclosureConfig = "Unified"
Else
enclosureConfig = "Not Applicable"
End If
Else
enclosureConfig = "Not Applicable"
End If

If (StrComp(Trim(connectorID), Trim(channelVal)) = 0) Then
Message = "DiscoverEnclosure : Parsing storage controller enclosure with ID " &amp; enclosureId &amp; " with display name " &amp; displayNameVal
MOMDebugLog 1, Message
set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Dell.WindowsServer.ControllerEnclosure']$")
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", targetComputer)
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.LogicalDevice']/DeviceID$", targetComputer)
call oInst.AddProperty("$MPElement[Name='ScalableWindowsServer!Dell.WindowsServer.StorageController']/DeviceID$", controllerID)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerConnector']/ID$", connectorID)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerEnclosure']/ID$", enclosureId)
call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", displayNameVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerEnclosure']/Connector$", channelVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerEnclosure']/TargetID$", targetIdVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerEnclosure']/Configuration$", enclosureConfig)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerEnclosure']/FirmwareVersion$", firmwareVerVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerEnclosure']/ServiceTag$", svcTagVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerEnclosure']/AssetTag$", assetTagVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerEnclosure']/AssetName$", assetNameVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerEnclosure']/BackplanePartNum$", backPlanePartNoVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerEnclosure']/SplitbusPartNum$", splitBusPartNoVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerEnclosure']/EnclosurePartNum$", enclPartNoVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerEnclosure']/SASAddress$", sasAddressVal)
Message = "DiscoverEnclosure : Submitting the data storage controller enclosure with ID " &amp; enclosureId &amp; " with display name " &amp; displayNameVal
MOMDebugLog 1, Message
call oDiscoveryData.AddInstance(oInst)

Message = "DiscoverEnclosure : Invoking enclosure Physical Disk discovery of controller " &amp; controllerID &amp; " with connector id " &amp; connectorID &amp; " and enclosure id " &amp; enclosureId
MOMDebugLog 1, Message
DiscoverEnclosurePhysicalDisk controllerID, connectorID, enclosureId

Message = "DiscoverEnclosure : Invoking temperature sensor discovery of controller " &amp; controllerID &amp; " with connector id " &amp; connectorID &amp; " and enclosure id " &amp; enclosureId
MOMDebugLog 1, Message
DiscoverTemperature controllerID, connectorID, enclosureId, enclSensorFlag

Message = "DiscoverEnclosure : Invoking enclosure Fan discovery of controller " &amp; controllerID &amp; " with connector id " &amp; connectorID &amp; " and enclosure id " &amp; enclosureId &amp; " and eclosure sensor flag :" &amp; enclSensorFlag
MOMDebugLog 1, Message
DiscoverFan controllerID, connectorID, enclosureId, enclSensorFlag

If enclSensorFlag = 1 Then
set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Dell.WindowsServer.EnclosureSensors']$")
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", targetComputer)
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.LogicalDevice']/DeviceID$", targetComputer)
call oInst.AddProperty("$MPElement[Name='ScalableWindowsServer!Dell.WindowsServer.StorageController']/DeviceID$", controllerID)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerConnector']/ID$", connectorID)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerEnclosure']/ID$", enclosureId)
call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "Sensors")
call oDiscoveryData.AddInstance(oInst)
End If

Message = "DiscoverEnclosure : Invoking enclosure powersupply discovery of controller " &amp; controllerID &amp; " with connector id " &amp; connectorID &amp; " and enclosure id " &amp; enclosureId
MOMDebugLog 1, Message
DiscoverPowerSupply controllerID, connectorID, enclosureId

Message = "DiscoverEnclosure : Invoking EMM discovery of controller "&amp; controllerID &amp; " with connector id " &amp; connectorID &amp; " and enclosure id " &amp; enclosureId
MOMDebugLog 1, Message
DiscoverEMM controllerID, connectorID, enclosureId
End If
Next
Else
Message = "Error: DOM object not created using CreateObject - Microsoft.XMLDOM"
MOMDebugLog 1, Message
End If
Else
Message = "Storage CLI XML Output File does not exist - " &amp; fileSpec
MOMDebugLog 1, Message
End If
' Clean up the CLI Output : Delete OM_REPORT_FILE_NAME for STORAGE
DelFile(filePath)
End If ' End of If Condition for rc&lt;&gt;0 for oshell.run(omreport storage controller)
Set filePath = Nothing
Set command = Nothing
Set oShell = Nothing
Set fileSpec = Nothing
End Function

Function ConvertRPSToMetricUnits(val)
Dim rpsVal, rpsUnits
rpsVal = val : rpsUnits = " Mbps"
If rpsVal &gt; 1024 Then
rpsVal = Round(rpsVal / 1024, 3) : rpsUnits = " Gbps"
If rpsVal &gt; 1024 Then
rpsVal = Round(rpsVal / 1024,3) : rpsUnits = " Tbps"
End If
End If
ConvertRPSToMetricUnits = rpsVal &amp; rpsUnits
End Function

Function DiscoverEnclosurePhysicalDisk (ByVal controllerID, ByVal connectorID, ByVal enclosureID)
'MOMDebugLog ("BeginEnclPhyDisk")
Dim filePath, command, fileSpec, x, y, oShell, result
Dim tempArray, tempSeperator, tempEnclosureID, encIDArray,xmlDoc,i
Dim pDiskLength,usedSpace,freeSpace,vendorId,productId,revision,displayName
Dim negotiatedSpeed,capableSpeed,sasAddress,attribMask,busProtocolVal,busProtocol,mfgDayVal,mfgWeekVal,mfgYearVal
Dim pDiskLengthVal,usedSpaceVal,freeSpaceVal,vendorIdVal,productIdVal,revisionVal,mfgDay,mfgWeek,mfgYear
Dim devSerialNo,devSerialNoVal,negotiatedSpeedVal,capableSpeedVal,sasAddressVal,attribMaskVal,hotSpare,mediaType,mediaTypeVal,pdMediaType
Dim targetId,targetIdVal,channel,channelVal,ctrlNo,ctrlNoVal,enclId,enclIdVal,pDiskProtocolType,pdId,freeSpaceInGb,usedSpaceInGb,capacityInGb
tempSeperator = ":"
Dim dcStorageObjects, dcStorageObjectsChildNode

const ONEGB = 1073741824
const ATTRIBMASKBIT24 = 24
const ATTRIBMASKBIT25 = 25
x = 1
y = 0

filePath = tempFolder &amp; "\" &amp; OM_REPORT_STORAGE_CONTR &amp; "controller_" &amp; controllerID &amp; "enclosure_pdisk.xml"
command = "cmd /C " &amp; chr(34) &amp; omsaBinPath &amp; "\" &amp; "omreport.exe" &amp; Chr(34) &amp; " storage pdisk controller=" &amp; controllerID &amp; " connector=" &amp; connectorID &amp; " -fmt xml -outc " &amp; filePath
Message = "DiscoverEnclosurePhysicalDisk : Executed omreport storage pdisk controller=" &amp; controllerID &amp; "connector=" &amp; connectorID &amp; " -fmt xml -outc " &amp; filePath
MOMDebugLog 1, Message
fileSpec = filePath
Set oShell = CreateObject ("WScript.Shell")
result = oShell.run (command,0,true)

If result &lt;&gt; 0 Then
DelFile(filePath)
Else
' Infinite Loop Until file OM_REPORT_FILE_NAME is created
Do While bFileExists(fileSpec) &lt;&gt; -1
WScript.Sleep(0)
x = x + 1
y = x Mod WAIT_LOOP

If y = 0 Then
'MOMDebugLog "Exit RunCmd. Reason: OMREPORT STORAGE not responding for " &amp; WAIT_LOOP &amp; " loops."
Exit Do
End If
Loop

If(bFileExists(fileSpec)) Then
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
If (IsObject(xmlDoc) = True) Then
xmlDoc.async = "false"
xmlDoc.load(fileSpec)
If (xmlDoc.parseError.errorCode &lt;&gt; 0) Then
Dim myErr
Set myErr = xmlDoc.parseError
Message = "XML Parse Error Reason: " &amp; myErr.reason
MOMDebugLog 1, Message
Message = "XML Parse Error Line: " &amp; myErr.line
MOMDebugLog 1, Message
Message = "XML Parse Error Character: " &amp; myErr.linepos
MOMDebugLog 1, Message
Message = "XML Parse Error Text: " &amp; myErr.srcText
MOMDebugLog 1, Message
DelFile(fileSpec)
Exit Function
End If

Set dcStorageObjects = xmlDoc.getElementsByTagName("DCStorageObject")

For i = 0 To (dcStorageObjects.length - 1)
Set dcStorageObjectsChildNode = dcStorageObjects(i)

Set pDiskLength = dcStorageObjectsChildNode.SelectSingleNode("Length")
Set usedSpace = dcStorageObjectsChildNode.SelectSingleNode("UsedSpace")
Set freeSpace = dcStorageObjectsChildNode.SelectSingleNode("FreeSpace")
Set vendorId = dcStorageObjectsChildNode.SelectSingleNode("Vendor")
Set productId = dcStorageObjectsChildNode.SelectSingleNode("ProductID")
Set revision = dcStorageObjectsChildNode.SelectSingleNode("Revision")
Set devSerialNo = dcStorageObjectsChildNode.SelectSingleNode("DeviceSerialNumber")
Set negotiatedSpeed = dcStorageObjectsChildNode.SelectSingleNode("NegotiatedSpeed")
Set capableSpeed = dcStorageObjectsChildNode.SelectSingleNode("CapableSpeed")
Set sasAddress = dcStorageObjectsChildNode.SelectSingleNode("SASAddress")
Set attribMask = dcStorageObjectsChildNode.SelectSingleNode("AttributesMask")
Set channel = dcStorageObjectsChildNode.SelectSingleNode("Channel")
Set targetId = dcStorageObjectsChildNode.SelectSingleNode("TargetID")
Set ctrlNo = dcStorageObjectsChildNode.SelectSingleNode("ControllerNum")
Set enclId = dcStorageObjectsChildNode.SelectSingleNode("EnclosureID")
Set busProtocol = dcStorageObjectsChildNode.SelectSingleNode("BusProtocol")
Set mfgDay = dcStorageObjectsChildNode.SelectSingleNode("ManufactureDay")
Set mfgWeek = dcStorageObjectsChildNode.SelectSingleNode("ManufactureWeek")
Set mfgYear = dcStorageObjectsChildNode.SelectSingleNode("ManufactureYear")
Set mediaType = dcStorageObjectsChildNode.SelectSingleNode("MediaType")

targetIdVal = targetId.nodeTypedValue

If busProtocol Is Nothing Then
busProtocolVal = ""
Else
busProtocolVal = busProtocol.nodeTypedValue
End If
If channel Is Nothing Then
channelVal = "Not Applicable"
Else
channelVal = channel.nodeTypedValue
End If
If enclId Is Nothing Then
enclIdVal = ""
Else
enclIdVal = enclId.nodeTypedValue
End If
If ctrlNo Is Nothing Then
ctrlNoVal = "Not Applicable"
Else
ctrlNoVal = ctrlNo.nodeTypedValue
End If
If attribMask Is Nothing Then
attribMaskVal = ""
Else
attribMaskVal = attribMask.nodeTypedValue
End If
If sasAddress Is Nothing Then
sasAddressVal = "Not Applicable"
Else
sasAddressVal = sasAddress.nodeTypedValue
End If
If capableSpeed Is Nothing Then
capableSpeedVal = "Not Applicable"
Else
capableSpeedVal = ConvertRPSToMetricUnits(capableSpeed.nodeTypedValue)
End If
If negotiatedSpeed Is Nothing Then
negotiatedSpeedVal = "Not Applicable"
Else
negotiatedSpeedVal = ConvertRPSToMetricUnits(negotiatedSpeed.nodeTypedValue)
End If
If devSerialNo Is Nothing Then
devSerialNoVal = "Not Applicable"
Else
devSerialNoVal = devSerialNo.nodeTypedValue
End If
If revision Is Nothing Then
revisionVal = "Not Applicable"
Else
revisionVal = revision.nodeTypedValue
End If
If productId Is Nothing Then
productIdVal = "Not Applicable"
Else
productIdVal = productId.nodeTypedValue
End If
If vendorId Is Nothing Then
vendorIdVal = "Not Applicable"
Else
vendorIdVal = vendorId.nodeTypedValue
End If
If freeSpace Is Nothing Then
freeSpaceVal = "Not Applicable"
freeSpaceInGb = "Not Applicable"
Else
freeSpaceVal = freeSpace.nodeTypedValue
freeSpaceInGb = freeSpaceVal / ONEGB
freeSpaceInGb = round(freeSpaceInGb,2)
freeSpaceInGb = freeSpaceInGb &amp; " GB" &amp; " (" &amp; freeSpaceVal &amp; " bytes)"
End If
If usedSpace Is Nothing Then
usedSpaceVal = "Not Applicable"
usedSpaceInGb = "Not Applicable"
Else
usedSpaceVal = usedSpace.nodeTypedValue
usedSpaceInGb = usedSpaceVal / ONEGB
usedSpaceInGb = round(usedSpaceInGb,2)
usedSpaceInGb = usedSpaceInGb &amp; " GB" &amp; " (" &amp; usedSpaceVal &amp; " bytes)"
End If
If pDiskLength Is Nothing Then
pDiskLengthVal = "Not Applicable"
capacityInGb = "Not Applicable"
Else
pDiskLengthVal = pDiskLength.nodeTypedValue
capacityInGb = pDiskLengthVal / ONEGB
capacityInGb = round(capacityInGb, 2)
capacityInGb = capacityInGb &amp; " GB" &amp; " (" &amp; pDiskLengthVal &amp; " bytes)"
End If
If mfgDay Is Nothing Then
mfgDayVal = "Not Applicable"
Else
mfgDayVal = mfgDay.nodeTypedValue
End If
If mfgWeek Is Nothing Then
mfgWeekVal = "Not Applicable"
Else
mfgWeekVal = mfgWeek.nodeTypedValue
End If
If mfgYear Is Nothing Then
mfgYearVal = "Not Applicable"
Else
mfgYearVal = mfgYear.nodeTypedValue
End If
If mediaType Is Nothing Then
mediaTypeVal = ""
Else
mediaTypeVal = mediaType.nodeTypedValue
End If

If ( StrComp(enclIdVal,"")&lt;&gt;0 ) Then
pdId = channelVal &amp; ":" &amp; enclIdVal &amp; ":" &amp; targetIdVal
Else
pdId = channelVal &amp; ":" &amp; targetIdVal
End If

displayName = "Physical Disk " &amp; pdId

If ( StrComp(mediaTypeVal,"")&lt;&gt;0) Then
If ( StrComp ( mediaTypeVal,"1")=0) Then
pdMediaType = "HDD"
ElseIf ( StrComp ( mediaTypeVal,"2")=0) Then
pdMediaType = "SSD"
ElseIf ( StrComp ( mediaTypeVal,"3")=0) Then
pdMediaType = "SSD, HDD"
Else
pdMediaType = "Not Applicable"
End If
Else
pdMediaType = "Not Applicable"
End If

If ( StrComp(busProtocolVal,"")&lt;&gt;0) Then
If ( StrComp ( busProtocolVal,"1")=0) Then
pDiskProtocolType = "SCSI"
ElseIf ( StrComp ( busProtocolVal,"2")=0) Then
pDiskProtocolType = "IDE"
ElseIf ( StrComp ( busProtocolVal,"7")=0) Then
pDiskProtocolType = "SATA"
ElseIf ( StrComp ( busProtocolVal,"8")=0) Then
pDiskProtocolType = "SAS"
ElseIf ( StrComp ( busProtocolVal,"9")=0) Then
pDiskProtocolType = "PCIe"
ElseIf ( StrComp ( busProtocolVal,"15")=0) Then
pDiskProtocolType = "SAS,SATA"
Else
pDiskProtocolType = "Not Available"
End If
Else
pDiskProtocolType = "Not Available"
End If

If ( StrComp(attribMaskVal,"")&lt;&gt;0) Then
If( Mid(attribMaskVal,ATTRIBMASKBIT25,1) = "1" ) Then
hotSpare = "Global"
ElseIf( Mid(attribMaskVal,ATTRIBMASKBIT24,1) = "1" ) Then
hotSpare = "Dedicated"
Else
hotSpare = "No"
End If
End If

If i = 0 Then
Message = "DiscoverEnclosurePhysicalDisk : creating enclosure physical disk Group"
MOMDebugLog 1, Message
set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Dell.WindowsServer.EnclosurePhysicalDiskGroup']$")
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", targetComputer)
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.LogicalDevice']/DeviceID$", targetComputer)
call oInst.AddProperty("$MPElement[Name='ScalableWindowsServer!Dell.WindowsServer.StorageController']/DeviceID$", controllerID)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerConnector']/ID$", connectorID)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerEnclosure']/ID$", enclosureID)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.EnclosurePhysicalDiskGroup']/Number$", enclosureID)
call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "Enclosure Physical Disk Group")
Message = "DiscoverEnclosurePhysicalDisk : submitting enclosure physical disk Group"
MOMDebugLog 1, Message
call oDiscoveryData.AddInstance(oInst)
End If

tempArray = split(pdId, tempSeperator, -1)
If (UBound(tempArray) = 2) Then
encIDArray = split(enclosureID, tempSeperator, -1)
If (UBound(encIDArray) = 1) Then
tempEnclosureID = encIDArray(1)
Else
tempEnclosureID = encIDArray(0)
End If
If (StrComp(Trim(tempEnclosureID), Trim(tempArray(1))) = 0) Then
Message = "DiscoverEnclosurePhysicalDisk : Parsing enclosure physical disk data with connectorID "&amp; connectorID &amp; " , enclosureID " &amp; enclosureID &amp; " and controllerID " &amp; controllerID &amp; " with display name " &amp; displayName
MOMDebugLog 1, Message
set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Dell.WindowsServer.EnclosurePhysicalDisk']$")
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", targetComputer)
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.LogicalDevice']/DeviceID$", targetComputer)
call oInst.AddProperty("$MPElement[Name='ScalableWindowsServer!Dell.WindowsServer.StorageController']/DeviceID$", controllerID)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerConnector']/ID$", connectorID)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerEnclosure']/ID$", enclosureID)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.EnclosurePhysicalDiskGroup']/Number$", enclosureID)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.EnclosurePhysicalDisk']/ID$", pdId)
call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", displayName)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.EnclosurePhysicalDisk']/Type$", pDiskProtocolType)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.EnclosurePhysicalDisk']/Capacity$", capacityInGb)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.EnclosurePhysicalDisk']/UsedRaidDiskSpace$", usedSpaceInGb)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.EnclosurePhysicalDisk']/AvailableRaidDiskSpace$", freeSpaceInGb)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.EnclosurePhysicalDisk']/HotSpare$", hotSpare)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.EnclosurePhysicalDisk']/VendorID$", vendorIdVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.EnclosurePhysicalDisk']/ProductID$", productIdVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.EnclosurePhysicalDisk']/Revision$", revisionVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.EnclosurePhysicalDisk']/SerialNumber$", devSerialNoVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.EnclosurePhysicalDisk']/NegotiatedSpeed$", negotiatedSpeedVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.EnclosurePhysicalDisk']/CapableSpeed$", capableSpeedVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.EnclosurePhysicalDisk']/ManufactureDay$", mfgDayVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.EnclosurePhysicalDisk']/ManufactureWeek$", mfgWeekVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.EnclosurePhysicalDisk']/ManufactureYear$", mfgYearVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.EnclosurePhysicalDisk']/SASAddress$", sasAddressVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.EnclosurePhysicalDisk']/MediaType$", pdMediaType)
Message = "DiscoverEnclosurePhysicalDisk : Submitting the data of enclosure physical disk with connectorID " &amp; connectorID &amp; " , enclosureID " &amp; enclosureID &amp; " and controllerID " &amp; controllerID &amp; " with display name " &amp; displayName
MOMDebugLog 1, Message
call oDiscoveryData.AddInstance(oInst)
End If
End If
Next
Else
Message = "Error: DOM object not created using CreateObject - Microsoft.XMLDOM"
MOMDebugLog 1, Message
End If
Else
Message = "Storage CLI XML Output File does not exist - " &amp; fileSpec
MOMDebugLog 1, Message
End If

' Clean up the CLI Output : Delete OM_REPORT_FILE_NAME for STORAGE
DelFile(filePath)
End If ' End of If Condition for rc&lt;&gt;0 for oshell.run(omreport storage controller)
Set filePath = Nothing
Set command = Nothing
Set oShell = Nothing
Set fileSpec = Nothing
End Function

Function DiscoverConnectorPhysicalDisk (ByVal controllerID, ByVal connectorID)
'MOMDebugLog ("BeginCxntrPDisk")

Dim filePath, command, fileSpec, x, y, oShell, result
Dim tempArray, tempSeperator,xmlDoc,i, connpdflag
Dim mediaType,pDiskLength,usedSpace,freeSpace,vendorId,productId,revision,displayName
Dim negotiatedSpeed,capableSpeed,sasAddress,attribMask,busProtocolVal,busProtocol,mfgDay,mfgWeek,mfgYear
Dim mediaTypeVal,pDiskLengthVal,usedSpaceVal,freeSpaceVal,vendorIdVal,productIdVal,revisionVal,mfgDayVal,mfgWeekVal,mfgYearVal
Dim devSerialNo,devSerialNoVal,negotiatedSpeedVal,capableSpeedVal,sasAddressVal,attribMaskVal,hotSpare,pdMediaType
Dim targetId,targetIdVal,channel,channelVal,ctrlNo,ctrlNoVal,enclId,enclIdVal,pDiskProtocolType,pdId,freeSpaceInGb,usedSpaceInGb,capacityInGb
tempSeperator = ":"
const ONEGB = 1073741824
const ATTRIBMASKBIT24 = 24
const ATTRIBMASKBIT25 = 25
x = 1
y = 0
connpdflag = 0

filePath = tempFolder &amp; "\" &amp; OM_REPORT_STORAGE_CONTR &amp; "controller_" &amp; controllerID &amp; "connector_pdisk.xml"
command = "cmd /C " &amp; chr(34) &amp; omsaBinPath &amp; "\" &amp; "omreport.exe" &amp; Chr(34) &amp; " storage pdisk controller=" &amp; controllerID &amp; " connector=" &amp; connectorID &amp; " -fmt xml -outc " &amp; filePath
Message = "DiscoverConnectorPhysicalDisk : Executed omreport storage pdisk controller=" &amp; controllerID &amp; "connector=" &amp; connectorID &amp; " -fmt xml -outc " &amp; filePath
MOMDebugLog 1, Message
fileSpec = filePath
Set oShell = CreateObject ("WScript.Shell")
result = oShell.run (command,0,true)

If result &lt;&gt; 0 Then
DelFile(filePath)
Else
' Infinite Loop Until file OM_REPORT_FILE_NAME is created
Do While bFileExists(fileSpec) &lt;&gt; -1
WScript.Sleep(0)
x = x + 1
y = x Mod WAIT_LOOP

If y = 0 Then
'MOMDebugLog "Exit RunCmd. Reason: OMREPORT STORAGE not responding for " &amp; WAIT_LOOP &amp; " loops."
Exit Do
End If
Loop

If(bFileExists(fileSpec)) Then
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
If (IsObject(xmlDoc) = True) Then
xmlDoc.async = "false"
xmlDoc.load(fileSpec)
If (xmlDoc.parseError.errorCode &lt;&gt; 0) Then
Dim myErr
Set myErr = xmlDoc.parseError
Message = "XML Parse Error Reason: " &amp; myErr.reason
MOMDebugLog 1, Message
Message = "XML Parse Error Line: " &amp; myErr.line
MOMDebugLog 1, Message
Message = "XML Parse Error Character: " &amp; myErr.linepos
MOMDebugLog 1, Message
Message = "XML Parse Error Text: " &amp; myErr.srcText
MOMDebugLog 1, Message
DelFile(fileSpec)
Exit Function
End If

Set pDiskLength = xmlDoc.getElementsByTagName("Length")
Set usedSpace = xmlDoc.getElementsByTagName("UsedSpace")
Set freeSpace = xmlDoc.getElementsByTagName("FreeSpace")
Set vendorId = xmlDoc.getElementsByTagName("Vendor")
Set productId = xmlDoc.getElementsByTagName("ProductID")
Set revision = xmlDoc.getElementsByTagName("Revision")
Set devSerialNo = xmlDoc.getElementsByTagName("DeviceSerialNumber")
Set negotiatedSpeed = xmlDoc.getElementsByTagName("NegotiatedSpeed")
Set capableSpeed = xmlDoc.getElementsByTagName("CapableSpeed")
Set sasAddress = xmlDoc.getElementsByTagName("SASAddress")
Set attribMask = xmlDoc.getElementsByTagName("AttributesMask")
Set channel = xmlDoc.getElementsByTagName("Channel")
Set targetId = xmlDoc.getElementsByTagName("TargetID")
Set ctrlNo = xmlDoc.getElementsByTagName("ControllerNum")
Set enclId = xmlDoc.getElementsByTagName("EnclosureID")
Set busProtocol = xmlDoc.getElementsByTagName("BusProtocol")
Set mfgDay = xmlDoc.getElementsByTagName("ManufactureDay")
Set mfgWeek = xmlDoc.getElementsByTagName("ManufactureWeek")
Set mfgYear = xmlDoc.getElementsByTagName("ManufactureYear")
Set mediaType = xmlDoc.getElementsByTagName("MediaType")

For i = 0 To (targetId.length -1)
targetIdVal = targetId.Item(i).nodeTypedValue

If busProtocol Is Nothing Or busProtocol.Item(i) Is Nothing Then
busProtocolVal = ""
Else
busProtocolVal = busProtocol.Item(i).nodeTypedValue
End If
If channel Is Nothing Or channel.Item(i) Is Nothing Then
channelVal = "Not Applicable"
Else
channelVal = channel.Item(i).nodeTypedValue
End If
If enclId Is Nothing Or enclId.Item(i) Is Nothing Then
enclIdVal = ""
Else
enclIdVal = enclId.Item(i).nodeTypedValue
End If
If ctrlNo Is Nothing Or ctrlNo.Item(i) Is Nothing Then
ctrlNoVal = "Not Applicable"
Else
ctrlNoVal = ctrlNo.Item(i).nodeTypedValue
End If
If attribMask Is Nothing Or attribMask.Item(i) Is Nothing Then
attribMaskVal = ""
Else
attribMaskVal = attribMask.Item(i).nodeTypedValue
End If
If sasAddress Is Nothing Or sasAddress.Item(i) Is Nothing Then
sasAddressVal = "Not Applicable"
Else
sasAddressVal = sasAddress.Item(i).nodeTypedValue
End If
If capableSpeed Is Nothing Or capableSpeed.Item(i) Is Nothing Then
capableSpeedVal = "Not Applicable"
Else
capableSpeedVal = ConvertRPSToMetricUnits(capableSpeed.Item(i).nodeTypedValue)
End If
If negotiatedSpeed Is Nothing Or negotiatedSpeed.Item(i) Is Nothing Then
negotiatedSpeedVal = "Not Applicable"
Else
negotiatedSpeedVal = ConvertRPSToMetricUnits(negotiatedSpeed.Item(i).nodeTypedValue)
End If
If devSerialNo Is Nothing Or devSerialNo.Item(i) Is Nothing Then
devSerialNoVal = "Not Applicable"
Else
devSerialNoVal = devSerialNo.Item(i).nodeTypedValue
End If
If revision Is Nothing Or revision.Item(i) Is Nothing Then
revisionVal = "Not Applicable"
Else
revisionVal = revision.Item(i).nodeTypedValue
End If
If productId Is Nothing Or productId.Item(i) Is Nothing Then
productIdVal = "Not Applicable"
Else
productIdVal = productId.Item(i).nodeTypedValue
End If
If vendorId Is Nothing Or vendorId.Item(i) Is Nothing Then
vendorIdVal = "Not Applicable"
Else
vendorIdVal = vendorId.Item(i).nodeTypedValue
End If
If freeSpace Is Nothing Or freeSpace.Item(i) Is Nothing Then
freeSpaceVal = "Not Applicable"
freeSpaceInGb = "Not Applicable"
Else
freeSpaceVal = freeSpace.Item(i).nodeTypedValue
freeSpaceInGb = freeSpaceVal / ONEGB
freeSpaceInGb = round(freeSpaceInGb, 2)
freeSpaceInGb = freeSpaceInGb &amp; " GB" &amp; " (" &amp; freeSpaceVal &amp; " bytes)"
End If
If usedSpace Is Nothing Or usedSpace.Item(i) Is Nothing Then
usedSpaceVal = "Not Applicable"
usedSpaceInGb = "Not Applicable"
Else
usedSpaceVal = usedSpace.Item(i).nodeTypedValue
usedSpaceInGb = usedSpaceVal / ONEGB
usedSpaceInGb = round(usedSpaceInGb,2)
usedSpaceInGb = usedSpaceInGb &amp; " GB" &amp; " (" &amp; usedSpaceVal &amp; " bytes)"
End If
If pDiskLength Is Nothing Or pDiskLength.Item(i) Is Nothing Then
pDiskLengthVal = "Not Applicable"
capacityInGb = "Not Applicable"
Else
pDiskLengthVal = pDiskLength.Item(i).nodeTypedValue
capacityInGb = pDiskLengthVal / ONEGB
capacityInGb = round(capacityInGb, 2)
capacityInGb = capacityInGb &amp; " GB" &amp; " (" &amp; pDiskLengthVal &amp; " bytes)"
End If
If mfgDay Is Nothing Or mfgDay.Item(i) Is Nothing Then
mfgDayVal = "Not Applicable"
Else
mfgDayVal = mfgDay.Item(i).nodeTypedValue
End If
If mfgWeek Is Nothing Or mfgWeek.Item(i) Is Nothing Then
mfgWeekVal = "Not Applicable"
Else
mfgWeekVal = mfgWeek.Item(i).nodeTypedValue
End If
If mfgYear Is Nothing Or mfgYear.Item(i) Is Nothing Then
mfgYearVal = "Not Applicable"
Else
mfgYearVal = mfgYear.Item(i).nodeTypedValue
End If
If mediaType Is Nothing Or mediaType.Item(i) Is Nothing Then
mediaTypeVal = ""
Else
mediaTypeVal = mediaType.Item(i).nodeTypedValue
End If

If ( StrComp(enclIdVal,"")&lt;&gt;0 ) Then
pdId = channelVal &amp; ":" &amp; enclIdVal &amp; ":" &amp; targetIdVal
Else
pdId = channelVal &amp; ":" &amp; targetIdVal
End If

displayName = "Physical Disk " &amp; pdId

If ( StrComp(mediaTypeVal,"")&lt;&gt;0) Then
If ( StrComp ( mediaTypeVal,"1")=0) Then
pdMediaType = "HDD"
ElseIf ( StrComp ( mediaTypeVal,"2")=0) Then
pdMediaType = "SSD"
ElseIf ( StrComp ( mediaTypeVal,"3")=0) Then
pdMediaType = "SSD, HDD"
Else
pdMediaType = "Not Applicable"
End If
Else
pdMediaType = "Not Applicable"
End If

If ( StrComp(busProtocolVal,"")&lt;&gt;0) Then
If ( StrComp ( busProtocolVal,"1")=0) Then
pDiskProtocolType = "SCSI"
ElseIf ( StrComp ( busProtocolVal,"2")=0) Then
pDiskProtocolType = "IDE"
ElseIf ( StrComp ( busProtocolVal,"7")=0) Then
pDiskProtocolType = "SATA"
ElseIf ( StrComp ( busProtocolVal,"8")=0) Then
pDiskProtocolType = "SAS"
ElseIf ( StrComp ( busProtocolVal,"9")=0) Then
pDiskProtocolType = "PCIe"
ElseIf ( StrComp ( busProtocolVal,"15")=0) Then
pDiskProtocolType = "SAS,SATA"
Else
pDiskProtocolType = "Not Available"
End If
Else
pDiskProtocolType = "Not Available"
End If


If ( StrComp(attribMaskVal,"")&lt;&gt;0) Then
If( Mid(attribMaskVal,ATTRIBMASKBIT25,1) = "1" ) Then
hotSpare = "Global"
ElseIf( Mid(attribMaskVal,ATTRIBMASKBIT24,1) = "1" ) Then
hotSpare = "Dedicated"
Else
hotSpare = "No"
End If
End If

tempArray = split(pdId, tempSeperator, -1)
If (UBound(tempArray) &lt;&gt; 2) Then

If connpdflag = 0 Then

Message = "DiscoverConnectorPhysicalDisk : creating connector physical disk Group"
MOMDebugLog 1, Message
set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Dell.WindowsServer.ConnectorPhysicalDiskGroup']$")
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", targetComputer)
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.LogicalDevice']/DeviceID$", targetComputer)
call oInst.AddProperty("$MPElement[Name='ScalableWindowsServer!Dell.WindowsServer.StorageController']/DeviceID$", controllerID)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerConnector']/ID$", connectorID)
call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "Connector Physical Disk Group")
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ConnectorPhysicalDiskGroup']/Number$", connectorID)
Message = "DiscoverConnectorPhysicalDisk : submitting connector physical disk Group"
MOMDebugLog 1, Message
call oDiscoveryData.AddInstance(oInst)
connpdflag = 1
End If
Message = "DiscoverConnectorPhysicalDisk : Parsing connector physical disk data with connectorID "&amp; connectorID &amp; " and controllerID " &amp; controllerID &amp; " with display name " &amp; displayName
MOMDebugLog 1, Message
set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Dell.WindowsServer.ConnectorPhysicalDisk']$")
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", targetComputer)
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.LogicalDevice']/DeviceID$", targetComputer)
call oInst.AddProperty("$MPElement[Name='ScalableWindowsServer!Dell.WindowsServer.StorageController']/DeviceID$", controllerID)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerConnector']/ID$", connectorID)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ConnectorPhysicalDiskGroup']/Number$", connectorID)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ConnectorPhysicalDisk']/ID$", pdId)
call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", displayName)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ConnectorPhysicalDisk']/Type$", pDiskProtocolType)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ConnectorPhysicalDisk']/Capacity$", capacityInGb)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ConnectorPhysicalDisk']/UsedRaidDiskSpace$", usedSpaceInGb)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ConnectorPhysicalDisk']/AvailableRaidDiskSpace$", freeSpaceInGb)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ConnectorPhysicalDisk']/HotSpare$", hotSpare)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ConnectorPhysicalDisk']/VendorID$", vendorIdVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ConnectorPhysicalDisk']/ProductID$", productIdVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ConnectorPhysicalDisk']/Revision$", revisionVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ConnectorPhysicalDisk']/SerialNumber$", devSerialNoVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ConnectorPhysicalDisk']/NegotiatedSpeed$", negotiatedSpeedVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ConnectorPhysicalDisk']/CapableSpeed$", capableSpeedVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ConnectorPhysicalDisk']/ManufactureDay$", mfgDayVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ConnectorPhysicalDisk']/ManufactureWeek$", mfgWeekVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ConnectorPhysicalDisk']/ManufactureYear$", mfgYearVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ConnectorPhysicalDisk']/SASAddress$", sasAddressVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ConnectorPhysicalDisk']/MediaType$", pdMediaType)
Message = "DiscoverConnectorPhysicalDisk : Submitting the connector physical disk data with connectorID "&amp; connectorID &amp; " and controllerID " &amp; controllerID &amp; " with display name " &amp; displayName
MOMDebugLog 1, Message
call oDiscoveryData.AddInstance(oInst)
End If
Next
Else
Message = "Error: DOM object not created using CreateObject - Microsoft.XMLDOM"
MOMDebugLog 1, Message
End If
Else
Message = "Storage CLI XML Output File does not exist - " &amp; fileSpec
MOMDebugLog 1, Message
End If

' Clean up the CLI Output : Delete OM_REPORT_FILE_NAME for STORAGE
DelFile(filePath)
End If ' End of If Condition for rc&lt;&gt;0 for oshell.run(omreport storage controller)
Set filePath = Nothing
Set command = Nothing
Set oShell = Nothing
Set fileSpec = Nothing
End Function

Function DiscoverTemperature (ByVal controllerID, ByVal connectorID, ByVal enclosureID, ByRef enclSensorFlag)
'MOMDebugLog ("BeginTempDiscover")
Dim filePath, command, fileSpec, x, y, oShell, result
Dim xmlDoc,obj
x = 1
y = 0

filePath = tempFolder &amp; "\" &amp; OM_REPORT_STORAGE_CONTR &amp; "controller_" &amp; controllerID &amp; "enclosure_temps.xml"
command = "cmd /C " &amp; chr(34) &amp; omsaBinPath &amp; "\" &amp; "omreport.exe" &amp; Chr(34) &amp; " storage enclosure controller=" &amp; controllerID &amp; " enclosure=" &amp; enclosureID &amp; " info=temps -fmt xml -outc " &amp; filePath
Message = "DiscoverTemperature : Executed omreport storage enclosure controller=" &amp; controllerID &amp; "enclosure=" &amp; enclosureID &amp; " info=temps -fmt xml -outc " &amp; filePath
MOMDebugLog 1, Message
fileSpec = filePath
Set oShell = CreateObject ("WScript.Shell")
result = oShell.run (command,0,true)

If result &lt;&gt; 0 Then
DelFile(filePath)
Else
' Infinite Loop Until file OM_REPORT_FILE_NAME is created
Do While bFileExists(fileSpec) &lt;&gt; -1
WScript.Sleep(0)
x = x + 1
y = x Mod WAIT_LOOP

If y = 0 Then
'MOMDebugLog "Exit RunCmd. Reason: OMREPORT STORAGE not responding for " &amp; WAIT_LOOP &amp; " loops."
Exit Do
End If
Loop

If(bFileExists(fileSpec)) Then
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
If (IsObject(xmlDoc) = True) Then
xmlDoc.async = "false"
xmlDoc.load(fileSpec)
If (xmlDoc.parseError.errorCode &lt;&gt; 0) Then
Dim myErr
Set myErr = xmlDoc.parseError
Message = "XML Parse Error Reason: " &amp; myErr.reason
MOMDebugLog 1, Message
Message = "XML Parse Error Line: " &amp; myErr.line
MOMDebugLog 1, Message
Message = "XML Parse Error Character: " &amp; myErr.linepos
MOMDebugLog 1, Message
Message = "XML Parse Error Text: " &amp; myErr.srcText
MOMDebugLog 1, Message
DelFile(fileSpec)
Exit Function
End If

Set obj = xmlDoc.getElementsByTagName("Index")

If(obj.length &gt; 0) Then
Message = "DiscoverTemperature : setting enclSensorFlag to 1"
MOMDebugLog 1, Message
enclSensorFlag = 1
Else
Message = "Empty return for Storage controller sensors. Not creating object"
MOMDebugLog 1, Message
End If
Else
Message = "Error: DOM object not created using CreateObject - Microsoft.XMLDOM"
MOMDebugLog 1, Message
End If
Else
Message = "Storage CLI XML Output File does not exist - " &amp; fileSpec
MOMDebugLog 1, Message
End If
' Clean up the CLI Output : Delete OM_REPORT_FILE_NAME for STORAGE
DelFile(filePath)
End If ' End of If Condition for rc&lt;&gt;0 for oshell.run(omreport storage controller)
Set filePath = Nothing
Set command = Nothing
Set oShell = Nothing
Set fileSpec = Nothing
End Function

Function DiscoverFan (ByVal controllerID, ByVal connectorID, ByVal enclosureID, ByRef enclSensorFlag)
'MOMDebugLog ("BeginFanDiscover")
Dim filePath, command, fileSpec, x, y, oShell, result
Dim xmlDoc,obj
x = 1
y = 0
'enclSensorFlag = 1

filePath = tempFolder &amp; "\" &amp; OM_REPORT_STORAGE_CONTR &amp; "controller_" &amp; controllerID &amp; "enclosure_fans.xml"
command = "cmd /C " &amp; chr(34) &amp; omsaBinPath &amp; "\" &amp; "omreport.exe" &amp; Chr(34) &amp; " storage enclosure controller=" &amp; controllerID &amp; " enclosure=" &amp; enclosureID &amp; " info=fans -fmt xml -outc " &amp; filePath
Message = "DiscoverFan : Executed omreport storage enclosure controller=" &amp; controllerID &amp; "enclosure=" &amp; enclosureID &amp; " info=fans -fmt xml -outc " &amp; filePath
MOMDebugLog 1, Message
fileSpec = filePath
Set oShell = CreateObject ("WScript.Shell")
result = oShell.run (command,0,true)

If result &lt;&gt; 0 Then
DelFile(filePath)
Else
' Infinite Loop Until file OM_REPORT_FILE_NAME is created
Do While bFileExists(fileSpec) &lt;&gt; -1
WScript.Sleep(0)
x = x + 1
y = x Mod WAIT_LOOP

If y = 0 Then
'MOMDebugLog "Exit RunCmd. Reason: OMREPORT STORAGE not responding for " &amp; WAIT_LOOP &amp; " loops."
Exit Do
End If
Loop

If(bFileExists(fileSpec)) Then
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
If (IsObject(xmlDoc) = True) Then
xmlDoc.async = "false"
xmlDoc.load(fileSpec)
If (xmlDoc.parseError.errorCode &lt;&gt; 0) Then
Dim myErr
Set myErr = xmlDoc.parseError
Message = "XML Parse Error Reason: " &amp; myErr.reason
MOMDebugLog 1, Message
Message = "XML Parse Error Line: " &amp; myErr.line
MOMDebugLog 1, Message
Message = "XML Parse Error Character: " &amp; myErr.linepos
MOMDebugLog 1, Message
Message = "XML Parse Error Text: " &amp; myErr.srcText
MOMDebugLog 1, Message
DelFile(fileSpec)
Exit Function
End If

Set obj = xmlDoc.getElementsByTagName("Index")

If(obj.length &gt; 0) Then
Message = "DiscoverFan : setting enclSensorFlag to 1"
MOMDebugLog 1, Message
enclSensorFlag = 1
Else
Message = "Empty return for Storage controller sensors. Not creating object"
MOMDebugLog 1, Message
End If
Else
Message = "Error: DOM object not created using CreateObject - Microsoft.XMLDOM"
MOMDebugLog 1, Message
End If
Else
Message = "Storage CLI XML Output File does not exist - " &amp; fileSpec
MOMDebugLog 1, Message
End If
' Clean up the CLI Output : Delete OM_REPORT_FILE_NAME for STORAGE
DelFile(filePath)
End If ' End of If Condition for rc&lt;&gt;0 for oshell.run(omreport storage controller)
Set filePath = Nothing
Set command = Nothing
Set oShell = Nothing
Set fileSpec = Nothing
End Function

Function DiscoverPowerSupply (ByVal controllerID, ByVal connectorID, ByVal enclosureID)
'MOMDebugLog ("BeginPSDiscover")
Dim filePath, command, fileSpec, x, y, oShell, result
Dim pwrSupplyID,pwrSupplyIDVal,partNo,partNoVal,displayName,xmlDoc,i
x = 1
y = 0

filePath = tempFolder &amp; "\" &amp; OM_REPORT_STORAGE_CONTR &amp; "controller_" &amp; controllerID &amp; "enclosure_ps.xml"
command = "cmd /C " &amp; chr(34) &amp; omsaBinPath &amp; "\" &amp; "omreport.exe" &amp; Chr(34) &amp; " storage enclosure controller=" &amp; controllerID &amp; " enclosure=" &amp; enclosureID &amp; " info=pwrsupplies -fmt xml -outc " &amp; filePath
Message = "DiscoverPowerSupply : Executed omreport storage enclosure controller=" &amp; controllerID &amp; "enclosure=" &amp; enclosureID &amp; " info=pwrsupplies -fmt xml -outc " &amp; filePath
MOMDebugLog 1, Message
fileSpec = filePath
Set oShell = CreateObject ("WScript.Shell")
result = oShell.run (command,0,true)

If result &lt;&gt; 0 Then
DelFile(filePath)
Else
' Infinite Loop Until file OM_REPORT_FILE_NAME is created
Do While bFileExists(fileSpec) &lt;&gt; -1
WScript.Sleep(0)
x = x + 1
y = x Mod WAIT_LOOP

If y = 0 Then
'MOMDebugLog "Exit RunCmd. Reason: OMREPORT STORAGE not responding for " &amp; WAIT_LOOP &amp; " loops."
Exit Do
End If
Loop

If(bFileExists(fileSpec)) Then
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
If (IsObject(xmlDoc) = True) Then
xmlDoc.async = "false"
xmlDoc.load(fileSpec)
If (xmlDoc.parseError.errorCode &lt;&gt; 0) Then
Dim myErr
Set myErr = xmlDoc.parseError
Message = "XML Parse Error Reason: " &amp; myErr.reason
MOMDebugLog 1, Message
Message = "XML Parse Error Line: " &amp; myErr.line
MOMDebugLog 1, Message
Message = "XML Parse Error Character: " &amp; myErr.linepos
MOMDebugLog 1, Message
Message = "XML Parse Error Text: " &amp; myErr.srcText
MOMDebugLog 1, Message
DelFile(fileSpec)
Exit Function
End If

Set pwrSupplyID = xmlDoc.getElementsByTagName("Index")
Set partNo = xmlDoc.getElementsByTagName("PartNo")

For i = 0 To (pwrSupplyID.length -1)
pwrSupplyIDVal = pwrSupplyID.Item(i).nodeTypedValue

If partNo Is Nothing Or partNo.Item(i) Is Nothing Then
partNoVal = "Not Applicable"
Else
partNoVal = partNo.Item(i).nodeTypedValue
End If

If i = 0 Then
Message = "DiscoverPowerSupply : Creating PowerSuppy Group "
MOMDebugLog 1, Message
set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Dell.WindowsServer.EnclosurePowerSupplyGroup']$")
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", targetComputer)
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.LogicalDevice']/DeviceID$", targetComputer)
call oInst.AddProperty("$MPElement[Name='ScalableWindowsServer!Dell.WindowsServer.StorageController']/DeviceID$", controllerID)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerConnector']/ID$", connectorID)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerEnclosure']/ID$", enclosureID)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.EnclosurePowerSupplyGroup']/Number$", enclosureID)
call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "Enclosure Power Supply Group")
Message = "DiscoverPowerSupply : Submitting PowerSuppy Group data "
MOMDebugLog 1, Message
call oDiscoveryData.AddInstance(oInst)
End If

displayName = "PS " &amp; pwrSupplyIDVal
Message = "DiscoverPowerSupply : Parsing enclosure powersupply data with enclosureID "&amp; enclosureID &amp; " and controllerID " &amp; controllerID &amp; " with display name " &amp; pwrSupplyIDVal
MOMDebugLog 1, Message
set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Dell.WindowsServer.EnclosurePowerSupply']$")
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", targetComputer)
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.LogicalDevice']/DeviceID$", targetComputer)
call oInst.AddProperty("$MPElement[Name='ScalableWindowsServer!Dell.WindowsServer.StorageController']/DeviceID$", controllerID)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerConnector']/ID$", connectorID)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerEnclosure']/ID$", enclosureID)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.EnclosurePowerSupplyGroup']/Number$", enclosureID)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.EnclosurePowerSupply']/ID$", pwrSupplyIDVal)
call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", displayName)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.EnclosurePowerSupply']/PartNumber$", partNoVal)
Message = "DiscoverPowerSupply : Submitting enclosure powersupply data with enclosureID "&amp; enclosureID &amp; " and controllerID " &amp; controllerID &amp; " with display name " &amp; pwrSupplyIDVal
MOMDebugLog 1, Message
call oDiscoveryData.AddInstance(oInst)
Next
Else
Message = "Error: DOM object not created using CreateObject - Microsoft.XMLDOM"
MOMDebugLog 1, Message
End If
Else
Message = "Storage CLI XML Output File does not exist - " &amp; fileSpec
MOMDebugLog 1, Message
End If

' Clean up the CLI Output : Delete OM_REPORT_FILE_NAME for STORAGE
DelFile(filePath)
End If ' End of If Condition for rc&lt;&gt;0 for oshell.run(omreport storage controller)
Set filePath = Nothing
Set command = Nothing
Set oShell = Nothing
Set fileSpec = Nothing
End Function

Function DiscoverEMM (ByVal controllerID, ByVal connectorID, ByVal enclosureID)
'MOMDebugLog ("BeginEMMDiscover")
Dim filePath, command, fileSpec, x, y, oShell, result
Dim xmlDoc,i,emmID,emmIDVal,displayName,partNo,partNoVal,firmwareVer,firmwareVerVal
Dim scsiSpeed,scsiSpeedVal,propType,propTypeVal,emmType
Dim emmObjState, emmObjStateVal
x = 1
y = 0

filePath = tempFolder &amp; "\" &amp; OM_REPORT_STORAGE_CONTR &amp; "controller_" &amp; controllerID &amp; "enclosure_emms.xml"
command = "cmd /C " &amp; chr(34) &amp; omsaBinPath &amp; "\" &amp; "omreport.exe" &amp; Chr(34) &amp; " storage enclosure controller=" &amp; controllerID &amp; " enclosure=" &amp; enclosureID &amp; " info=emms -fmt xml -outc " &amp; filePath
Message = "DiscoverEMM : Executed omreport storage enclosure controller=" &amp; controllerID &amp; "enclosure=" &amp; enclosureID &amp; " info=emms -fmt xml -outc " &amp; filePath
MOMDebugLog 1, Message
fileSpec = filePath
Set oShell = CreateObject ("WScript.Shell")
result = oShell.run (command,0,true)

If result &lt;&gt; 0 Then
DelFile(filePath)
Else
' Infinite Loop Until file OM_REPORT_FILE_NAME is created
Do While bFileExists(fileSpec) &lt;&gt; -1
WScript.Sleep(0)
x = x + 1
y = x Mod WAIT_LOOP

If y = 0 Then
'MOMDebugLog "Exit RunCmd. Reason: OMREPORT STORAGE not responding for " &amp; WAIT_LOOP &amp; " loops."
Exit Do
End If
Loop

If(bFileExists(fileSpec)) Then
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
If (IsObject(xmlDoc) = True) Then
xmlDoc.async = "false"
xmlDoc.load(fileSpec)
If (xmlDoc.parseError.errorCode &lt;&gt; 0) Then
Dim myErr
Set myErr = xmlDoc.parseError
Message = "XML Parse Error Reason: " &amp; myErr.reason
MOMDebugLog 1, Message
Message = "XML Parse Error Line: " &amp; myErr.line
MOMDebugLog 1, Message
Message = "XML Parse Error Character: " &amp; myErr.linepos
MOMDebugLog 1, Message
Message = "XML Parse Error Text: " &amp; myErr.srcText
MOMDebugLog 1, Message
DelFile(fileSpec)
Exit Function
End If

Set emmID = xmlDoc.getElementsByTagName("Index")
Set partNo = xmlDoc.getElementsByTagName("PartNo")
Set firmwareVer = xmlDoc.getElementsByTagName("FirmwareVer")
Set scsiSpeed = xmlDoc.getElementsByTagName("MaxSCSISpeed")
Set propType = xmlDoc.getElementsByTagName("PropTypeString")
set emmObjState = xmlDoc.getElementsByTagName("ObjState")

For i = 0 To (emmID.length -1)
emmIDVal = emmID.Item(i).nodeTypedValue

If partNo Is Nothing Or partNo.Item(i) Is Nothing Then
partNoVal = "Not Applicable"
Else
partNoVal = partNo.Item(i).nodeTypedValue
End If
If firmwareVer Is Nothing Or firmwareVer.Item(i) Is Nothing Then
firmwareVerVal = "Not Applicable"
Else
firmwareVerVal = firmwareVer.Item(i).nodeTypedValue
End If
If scsiSpeed Is Nothing Or scsiSpeed.Item(i) Is Nothing Then
scsiSpeedVal = "Not Applicable"
Else
scsiSpeedVal = scsiSpeed.Item(i).nodeTypedValue
End If
If propType Is Nothing Or propType.Item(i) Is Nothing Then
propTypeVal = ""
Else
propTypeVal = propType.Item(i).nodeTypedValue
End If

If emmObjState Is Nothing Or emmObjState.Item(i) Is Nothing Then
emmObjStateVal = "Not Applicable"
Else
emmObjStateVal = emmObjState.Item(i).nodeTypedValue
End If

displayName = "EMM " &amp; emmIDVal

If ( StrComp(propTypeVal,"")&lt;&gt;0) Then
If ( StrComp ( propTypeVal,"Expander")=0) Then
emmType = "SCSI SES Module"
ElseIf ( StrComp ( propTypeVal,"Terminator")=0) Then
emmType = "SCSI Terminator"
Else
emmType = "Not Available"
End If
Else
emmType = "Not Available"
End If


Message = "DiscoverEMM : Parsing EMM data with enclosureID " &amp; enclosureID &amp; " and controllerID " &amp; controllerID &amp; " with display name " &amp; displayName
MOMDebugLog 1, Message

if emmObjStateVal = "16" Then
set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Dell.WindowsServer.NotInstalled.EMM']$")
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", targetComputer)
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.LogicalDevice']/DeviceID$", targetComputer)
call oInst.AddProperty("$MPElement[Name='ScalableWindowsServer!Dell.WindowsServer.StorageController']/DeviceID$", controllerID)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerConnector']/ID$", connectorID)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerEnclosure']/ID$", enclosureID)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.NotInstalled.EMM']/ID$", emmIDVal)
call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", displayName)
Else
set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Dell.WindowsServer.EnclosureEMM']$")
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", targetComputer)
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.LogicalDevice']/DeviceID$", targetComputer)
call oInst.AddProperty("$MPElement[Name='ScalableWindowsServer!Dell.WindowsServer.StorageController']/DeviceID$", controllerID)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerConnector']/ID$", connectorID)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.ControllerEnclosure']/ID$", enclosureID)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.EnclosureEMM']/ID$", emmIDVal)
call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", displayName)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.EnclosureEMM']/PartNumber$", partNoVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.EnclosureEMM']/FirmwareVersion$", firmwareVerVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.EnclosureEMM']/SCSIRate$", scsiSpeedVal)
call oInst.AddProperty("$MPElement[Name='Dell.WindowsServer.EnclosureEMM']/Type$", emmType)
End If
Message = "DiscoverEMM : Submitting EMM data with enclosureID " &amp; enclosureID &amp; " and controllerID " &amp; controllerID &amp; " with display name " &amp; displayName
MOMDebugLog 1, Message
call oDiscoveryData.AddInstance(oInst)
Next
Else
Message = "Error: DOM object not created using CreateObject - Microsoft.XMLDOM"
MOMDebugLog 1, Message
End If
Else
Message = "Storage CLI XML Output File does not exist - " &amp; fileSpec
MOMDebugLog 1, Message
End If
' Clean up the CLI Output : Delete OM_REPORT_FILE_NAME for STORAGE
DelFile(filePath)
End If ' End of If Condition for rc&lt;&gt;0 for oshell.run(omreport storage controller)
Set filePath = Nothing
Set command = Nothing
Set oShell = Nothing
Set fileSpec = Nothing
End Function
End Class
</Script></ScriptBody>
<TimeoutSeconds>300</TimeoutSeconds>
</DataSource>
</MemberModules>
<Composition>
<Node ID="DS"/>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.Discovery.Data</OutputType>
</DataSourceModuleType>