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 + "\HPEStoreEverTapeLibraries.log"
Set objTextFile = objFSO.OpenTextFile(tempFilePath, 8, True)
objTextFile.WriteLine(strText)
objTextFile.Close
End Function
Function HexOIDToAscii(var_hex, format)
Dim k, v
HexOIDToAscii = ""
For k = 1 To Len(var_hex) Step 2
v = CInt("&H" & Mid(var_hex, k, 2))
If ((v>31) And (v<128)) Then
HexOIDToAscii = HexOIDToAscii & (chr(v))
Else
If (format) Then
Select Case v
Case 8
HexOIDToAscii= HexOIDToAscii & vbTab
Case 10
HexOIDToAscii = HexOIDToAscii & vbCrLf
Case 13
Case Else
HexOIDToAscii = HexOIDToAscii & "."
End Select
Else
HexOIDToAscii = HexOIDToAscii & "."
End If
End If
Next
OID = mid(HexOIDToAscii,1,len(HexOIDToAscii))
LeftOID = Left(OID,1)
CheckOID = StrComp(LeftOID,"1")
if(CheckOID = 0) then
HexOIDToAscii = OID
else
HexOIDToAscii = mid(HexOIDToAscii,2,len(HexOIDToAscii))
End if
End Function
Function HexStrToAscii(var_hex, format)
Dim k, v
HexStrToAscii = ""
For k = 1 To Len(var_hex) Step 2
v = CInt("&H" & Mid(var_hex, k, 2))
If ((v>31) And (v<128)) Then
HexStrToAscii = HexStrToAscii & (chr(v))
Else
If (format) Then
Select Case v
Case 8
HexStrToAscii = HexStrToAscii & vbTab
Case 10
HexStrToAscii = HexStrToAscii & vbCrLf
Case 13
Case Else
HexStrToAscii = HexStrToAscii & "."
End Select
Else
HexStrToAscii = HexStrToAscii & "."
End If
End If
Next
End Function
Function GetDeviceType(deviceOid)
GetDeviceType = null
Set oRe = CreateObject("VBScript.RegExp")
oRe.Global = True
oRe.Multiline = True
oRe.Pattern = TapeLibrary
If oRe.Test(deviceOid) Then
GetDeviceType = "TL"
End If
End Function
Function TapeLibType(deviceOid)
TapeLibType = null
Select Case deviceOid
Case TapeLibrary_C7200 TapeLibType = "TLC7200"
Case TapeLibrary_C7200iSCSI TapeLibType = "TLC7200iSCSI"
Case TapeLibrary_ESL9198 TapeLibType = "TLESL9198"
Case TapeLibrary_ESL9322 TapeLibType = "TLESL9322"
Case TapeLibrary_ESL9595 TapeLibType = "TLESL9595"
Case TapeLibrary_ESL9326 TapeLibType = "TLESL9326"
Case TapeLibrary_MSL5026 TapeLibType = "TLMSL5026"
Case TapeLibrary_MSL5030 TapeLibType = "TLMSL5030"
Case TapeLibrary_MSL5030 TapeLibType = "TLMSL5030"
Case TapeLibrary_MSL5052 TapeLibType = "TLMSL5052"
Case TapeLibrary_MSL5060 TapeLibType = "TLMSL5060"
Case TapeLibrary_MSL6026 TapeLibType = "TLMSL6026"
Case TapeLibrary_MSL6030 TapeLibType = "TLMSL6030"
Case TapeLibrary_MSL6052 TapeLibType = "TLMSL6052"
Case TapeLibrary_MSL6060 TapeLibType = "TLMSL6060"
Case TapeLibrary_ESL630 TapeLibType = "TLESL630"
Case TapeLibrary_ESL712 TapeLibType = "TLESL712"
Case TapeLibrary_ESL322 TapeLibType = "TLESL322"
Case TapeLibrary_ESL286 TapeLibType = "TLESL286"
Case TapeLibrary_EML103e TapeLibType = "TLEML103e"
Case TapeLibrary_EML245e TapeLibType = "TLEML245e"
Case TapeLibrary_VLS6000 TapeLibType = "TLVLS6000"
Case TapeLibrary_VLSg TapeLibType = "TLVLSg"
Case TapeLibrary_MSLG3 TapeLibType = "TLMSLG3"
Case TapeLibrary_ESLG3 TapeLibType = "TLESLG3"
Case TapeLibrary_MSL6480 TapeLibType = "TLMSL6480"
Case TapeLibrary_MSL4048 TapeLibType = "TLMSL4048"
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)
flag = 0
For intT2 = 0 to intT1
if(tmpArr2(intT2) = "") then
t = 0
else
if(tmpArr2(intT2) = "hpHttpMgDevice SysObjID") then
strV = HexOIDToAscii(tmpArr3(intT2),true)
DeviceCategory = GetDeviceType(strV)
If DeviceCategory = "TL" Then
DeviceType = TapeLibType(strV)
' Call oAPI.LogScriptEvent("", 104, 0, DeviceType)
flag = 1
exit for
end if
end if
end if
Next
Call oBag.AddValue("EventSource", DeviceType)
if(flag) then
For intT2 = 0 to intT1
if(tmpArr2(intT2) = "") then
t = 0
else
if(instr(tmpArr2(intT2),"hpHttpMg")) then
str = tmpArr2(intT2)
strV = tmpArr3(intT2)
intT5 = Instr(str,"hpHttpMg")
tmpArr2(intT2) = Mid(str, intT5 + 8)
if(tmpArr2(intT2) = "Device SysObjID") then
tmpArr3(intT2) = HexOIDToAscii(strV,true)
elseif(tmpArr2(intT2) = "Device Index") then
tmpArr3(intT2) = strV
else
tmpArr3(intT2)= HexStrToAscii(strV,true)
end if
end if
desc = desc & vbLf & tmpArr2(intT2) & ": " & tmpArr3(intT2)
Call oBag.AddValue(tmpArr2(intT2), tmpArr3(intT2))
end if
Next
severity = EVENT_TYPE_ERROR
if(severity = EVENT_TYPE_ERROR) then
Call oAPI.LogScriptEvent("", 114, severity, desc)
end if
Call oBag.AddValue("EventLevel", severity)
DebugMsg("Begin:" & "EventSource:" & DeviceType & ";Description:" & desc & ";EventLevel:" & severity & ";END")
Call oAPI.AddItem(oBag)
set oBag = nothing
Call oAPI.ReturnItems()