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 trapFile = fso.OpenTextFile(testFilePath, ForReading, True)
dim lines()
dim linepart
dim oidstring, trapoid
dim TrapSeverity
dim nooflines, j, k, flag
dim paramaterno, varno
dim newline
dim trapstring, intTmp, intTmp2, intTmp3
flag = true
nooflines = 0
while not trapFile.atEndOfStream
redim preserve lines(nooflines)
lines(ubound(lines)) = trapFile.readline
nooflines = nooflines+1
wend
End Function
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 )
'strText = "DebugMsg: " + TextMsg
CurrentDate = Now
strText = "DebugMsg: " & FormatDateTime(CurrentDate, 0) & ":" & TextMsg
'strText = test & ":" & strInstallDir
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Shell.Application")
set wshshell = CreateObject("WScript.Shell")
systemDrive = wshshell.ExpandEnvironmentStrings("%SystemDrive%")
tempFilePath = strInstallDir + "\HPEStoreVirtual.log"
Set objTextFile = objFSO.OpenTextFile(tempFilePath, 8, True)
objTextFile.WriteLine(strText)
objTextFile.Close
End Function
intT2 = intT2 + 1
If(Instr(strT2,"key:")) Then
tmpArr3(intT4) = ""
Else
tmpArr3(intT4) = strT2
End If
intT4 = intT4 + 1
End If
Next
intT1 = Ubound(tmpArr2)
For i = 0 To oArgs.Count
if oArgs(i) = "key:lhnMessage" then
j = i
j = j + 1
desc = oArgs(j)
exit for
end if
Next
Call oBag.AddValue("Event", desc)
For intT2 = 0 to intT1
If(tmpArr2(intT2) = "") Then
t = 0
ElseIf(Trim(tmpArr3(intT2)) <> "" And tmpArr3(intT2) <> "null" And Not IsNull(tmpArr3(intT2))) Then
desc = desc & vbLf & tmpArr2(intT2) & ": " & tmpArr3(intT2)
Call oBag.AddValue(tmpArr2(intT2), tmpArr3(intT2))
End If
Next
For i = 0 To oArgs.Count
if oArgs(i) = "key:lhnEventID" then
j = i
j = j + 1
sev = oArgs(j)
exit for
end if
Next
sev = GetTrapSeverity(sev)
severity = EVENT_TYPE_WARNING
If sev = "Critical" Then
severity = EVENT_TYPE_ERROR
ElseIf sev = "Warning" Then
severity = EVENT_TYPE_WARNING
ElseIf sev = "Informational" Then
severity = EVENT_TYPE_INFORMATION
End If
DebugMsg(desc)
if(severity = EVENT_TYPE_WARNING) then
Call oAPI.LogScriptEvent("", 103, severity, desc)
end if
if(severity = EVENT_TYPE_ERROR) then
Call oAPI.LogScriptEvent("", 103, severity, desc)
end if
Call oBag.AddValue("EventLevel", severity)
Call oAPI.AddItem(oBag)
set oBag = nothing
Call oAPI.ReturnItems()