Function DebugMsg(TextMsg)
Dim strText
Dim systemDrive
Dim tempFilePath
Dim wshShell
Dim CurrentDateTime
Dim NumArgs
Dim severity
Dim sevDesc
Set objShell = CreateObject("Wscript.Shell")
Const PROGRAM_FILES = &H26&
strSystemDrive = objShell.ExpandEnvironmentStrings("%SystemDrive%")
strtestFilePath = strSystemDrive & "\Program Files (x86)\"
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(strtestFilePath) Then
win64 = false
test = "32bit"
Else
win64 = true
test = "64bit"
End If
if win64 then
strRegistryKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Hewlett-Packard\HP Storage Management Pack for System Center\InstallPath"
else
strRegistryKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Hewlett-Packard\HP Storage Management Pack for System Center\InstallPath"
end if
Set WSHShell = CreateObject("WScript.Shell")
strInstallDir = WSHShell.RegRead( strRegistryKey )
CurrentDate = Now
strText = "DebugMsg: " & FormatDateTime(CurrentDate, 0) & ":" & TextMsg
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Shell.Application")
set wshshell = CreateObject("WScript.Shell")
systemDrive = wshshell.ExpandEnvironmentStrings("%SystemDrive%")
tempFilePath = strInstallDir + "\HPEXP9000.log"
Set objTextFile = objFSO.OpenTextFile(tempFilePath, 8, True)
objTextFile.WriteLine(strText)
objTextFile.Close
End Function
Function RefcodeToDescMapping(Refcode)
Const ForReading = 1, ForWriting = 2
dim fso, MyFile
dim lines()
dim errorstring
Dim oRe
dim i
dim found, k, j
dim pattern
'Refcode = "BF1211"
pattern = Refcode
'RSIMFILE = "XP2048RSimFile.txt"
'dim found
found = 0
i = 0
Dim systemDrive
Dim testFilePath
Dim tempFilePath
Dim programFilesPath
Dim wshShell
Set objShell = CreateObject("Wscript.Shell")
Const PROGRAM_FILES = &H26&
strSystemDrive = objShell.ExpandEnvironmentStrings("%SystemDrive%")
strtestFilePath = strSystemDrive & "\Program Files (x86)\"
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(strtestFilePath) Then
win64 = false
test = "32bit"
Else
win64 = true
test = "64bit"
End If
if win64 then
strRegistryKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Hewlett-Packard\HP Storage Management Pack for System Center\InstallPath"
else
strRegistryKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Hewlett-Packard\HP Storage Management Pack for System Center\InstallPath"
end if
Set WSHShell = CreateObject("WScript.Shell")
strInstallDir = WSHShell.RegRead( strRegistryKey )
tempFilePath = strInstallDir & "\\RefCodeToErrorMsg.conf"
Set MyFile = fso.OpenTextFile(tempFilePath, ForReading, True)
while not MyFile.atEndOfStream
redim preserve lines(i)
lines(ubound(lines)) = Myfile.readline
'wscript.echo lines(i)
'wscript.echo "next"
i = i+1
wend
Myfile.close
Set oRe = CreateObject("VBScript.RegExp")
oRe.Global = True
oRe.Multiline = True
tempFilePath = strInstallDir
Set MyFile = fso.OpenTextFile(tempFilePath & RSIMFILE, ForReading, True)
pattern = "Refcode=" & Refcode
dim singleline()
i=0
while not MyFile.atEndOfStream
redim preserve singleline(i)
singleline(ubound(singleline)) = Myfile.readline
i = i+1
wend
for k = len(pattern) to 10 step -1
for j = 0 to i-1 step 1
oRe.pattern = pattern
if oRe.Test(singleline(j)) then
Select Case deviceOid
Case CVXP XPType = "CVXP"
DebugMsg("XPType Entry1")
Case XP1024SVP XPType = "XP1024"
RSIMFILE = "XP128RSimFile.txt"
DebugMsg("XPType Entry5")
Case XP12000SVP XPType = "XP12000"
RSIMFILE = "XP2048RSimFile.txt"
Case XP24000SVP XPType = "XP24000"
DebugMsg("XPType Entry7")
Case P9500 XPType = "P9500"
DebugMsg("XPType Entry8")
End Select
DebugMsg("XPType Entry..." & deviceoid & XPType & RSIMFILE)
End Function
Function RefcodeToDescMapping(Refcode)
Const ForReading = 1, ForWriting = 2
dim fso, MyFile
dim lines()
dim errorstring
Dim oRe
dim i
dim found, k, j
dim pattern
'Refcode = "BF1211"
pattern = Refcode
RSIMFILE = "XP2048RSimFile.txt"
'dim found
found = 0
i = 0
Dim systemDrive
Dim testFilePath
Dim tempFilePath
Dim programFilesPath
Dim wshShell
Set objShell = CreateObject("Wscript.Shell")
Const PROGRAM_FILES = &H26&
strSystemDrive = objShell.ExpandEnvironmentStrings("%SystemDrive%")
strtestFilePath = strSystemDrive & "\Program Files (x86)\"
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(strtestFilePath) Then
win64 = false
test = "32bit"
Else
win64 = true
test = "64bit"
End If
if win64 then
strRegistryKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Hewlett-Packard\HP Storage Management Pack for System Center\InstallPath"
else
strRegistryKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Hewlett-Packard\HP Storage Management Pack for System Center\InstallPath"
end if
Set WSHShell = CreateObject("WScript.Shell")
strInstallDir = WSHShell.RegRead( strRegistryKey )
tempFilePath = strInstallDir & "\\RefCodeToErrorMsg.conf"
Set MyFile = fso.OpenTextFile(tempFilePath, ForReading, True)
while not MyFile.atEndOfStream
redim preserve lines(i)
lines(ubound(lines)) = Myfile.readline
'wscript.echo lines(i)
'wscript.echo "next"
i = i+1
wend
Myfile.close
Set oRe = CreateObject("VBScript.RegExp")
oRe.Global = True
oRe.Multiline = True
tempFilePath = strInstallDir
Set MyFile = fso.OpenTextFile(tempFilePath & RSIMFILE, ForReading, True)
pattern = "Refcode=" & Refcode
dim singleline()
i=0
while not MyFile.atEndOfStream
redim preserve singleline(i)
singleline(ubound(singleline)) = Myfile.readline
i = i+1
wend
for k = len(pattern) to 10 step -1
for j = 0 to i-1 step 1
oRe.pattern = pattern
if oRe.Test(singleline(j)) then
Set oAPI = CreateObject("MOM.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()
Set oArgs = WScript.Arguments
DebugMsg("Begin")
intT1 = oArgs.Count
intT1 = intT1 - 1
For intT2 = 0 To intT1
tmpArr1(intT2) = oArgs(intT2)
Next
intT2 = 0
intT4 = 0
For intT3 = 0 To intT1
strT1 = tmpArr1(intT3)
strT2 = tmpArr1(intT3 + 1)
If(Instr(strT1,"key:")) Then
intT5 = Instr(strT1,"key:")
strT = Mid(strT1,intT5 + 4)
tmpArr2(intT2) = strT
intT2 = intT2 + 1
If(Instr(strT2,"key:")) Then
tmpArr3(intT4) = ""
Else
tmpArr3(intT4) = strT2
End If
intT4 = intT4 + 1
End If
Next
For intT2 = 0 to intT1
if(tmpArr2(intT2) = "") then
t = 0
else
if(tmpArr2(intT2) = "EventTrapREFCODE") then
refCode = tmpArr3(intT2)
exit for
end if
end if
Next
intT1 = Ubound(tmpArr2)
Call oBag.AddValue("EventSource", "HPE XP 9000")
For intT2 = 0 to intT1
if(tmpArr2(intT2) = "") then
t = 0
else
desc = desc & vbLf & tmpArr2(intT2) & ": " & tmpArr3(intT2)
Call oBag.AddValue(tmpArr2(intT2), tmpArr3(intT2))
end if
Next
severity = EVENT_TYPE_INFORMATION
Call oBag.AddValue("EventLevel", severity)
Call oAPI.AddItem(oBag)
set oBag = nothing
Call oAPI.ReturnItems()