if(isConfigured = false AND freeIndex <> 0) Then
MOMDebugLog 1, "Given MS IPAddress is not configured. Hence, it will be configured at the free Index:" & freeIndex
MOMDebugLog 1, "-------------Calling ConfigDRACTrapDst()----------------"
ConfigDRACTrapDst
DelFile(strRacadmFileOutput)
MOMDebugLog 1, "-------------Calling EnableConfiguration()--------------"
EnableConfiguration
DelFile(strRacadmFileOutput)
end if
Set oAPI = CreateMOMScriptAPI()
set oBag = CreatePropertyBag (oAPI)
MOMDebugLog 1, "Status" & Status
oInstAddValue oBag, "Status" , Status
message = "Successfully configured"
if StrComp(Status, "Failure") = 0 Then
message = "Unable to configure the SNMP Trap destination:" & MS_IPAddress & " on the Device:" & DRAC_IPAddress
message = message & " This is because the device contains maximum number of SNMP Trap destinations already configured."
end if
oInstAddValue oBag, "Message", message
ReturnData oAPI, oBag
Set oAPI = Nothing
'********** SCOM Functions
'Initialize log-file according to log-level
Function InitLogging(ByRef logLevel)
' Begin Logheader
If logLevel <> 0 Then
strFileName = "Dell_DRAC_TrapCfg_" & DRAC_IPAddress & ".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
tFolder = tFolder & "\DracTrapCfg"
If Not objLogFSO.FolderExists(tFolder) Then
objLogFSO.CreateFolder(tFolder)
End If
strOutFile = tFolder & "\" & strFileName
If Not objLogFSO.FileExists(strOutFile) Then
Set objLogTextFile = objLogFSO.CreateTextFile(strOutFile)
objLogTextFile.Close()
End If
fileSize = objLogFSO.GetFile(strOutFile).Size
If (fileSize > MaxFileSize) Then
Dim dateStr, datesuffix, timesuffix, subStrLoc, newFilename
dateStr = CDate(Now())
datesuffix = ( Year(dateStr)*100 + Month(dateStr) )*100 + Day(dateStr)
timesuffix = Right((Hour(dateStr)*100+Minute(dateStr))*100+Second(dateStr)+1e7, 6)
subStrLoc = Instr(1, strOutFile,".log")
newFilename = Mid(strOutFile,1,(subStrLoc-1))
newFilename = newFilename &"-"& datesuffix &"-"&timesuffix&".log"
objLogFSO.MoveFile strOutFile, newFilename
Set objLogTextFile = objLogFSO.OpentextFile(strOutFile, ForWriting, True)
Else
Set objLogTextFile = objLogFSO.OpentextFile(strOutFile, ForAppending, True)
End If
logMessage = "INFO: Script - DellDRACTrapCfg : Start()"
MOMDebugLog 1, logMessage
Err.Clear
End If
End Function
Sub MOMDebugLog (ByVal debugLevel, ByVal Message)
On Error Resume Next
DebugOut Message
If (debugLevel > 0) and (debugLevel <= logLevel) Then
objLogTextFile.WriteLine(Now() & " ---- " & Message)
Err.Clear
End If
End Sub
Function EnableConfiguration()
MOMDebugLog 1, "---------Entered EnableConfiguration()-----------"
GetRACADMPath racadmPath
If racadmPath = "" Then
LogMessage = "GetRACADMPath function Error - " & rc
MOMDebugLog 1, LogMessage
Err.Clear
Exit Function
Else
LogMessage = "GetRACADMPath:: " & racadmPath
MOMDebugLog 1, LogMessage
End If
Dim TypeLib, NewGUID, fileGuid
Set TypeLib = CreateObject("Scriptlet.TypeLib")
NewGUID = TypeLib.Guid
fileGuid= (left(NewGUID, len(NewGUID)-2))
strRacadmFileOutput = "Dell_DRAC_Trap_Cfg_enable_" & DRAC_IPAddress & "_" & fileGuid & ".txt"
Dim logStrCommand, strCommand, objLogFSO1, oFile, strLine
Const ForReading = 1
strCommand = "cmd /C " & chr(34) & racadmPath & "\" & "racadm.exe" & Chr(34) & " -r " & DRAC_IPAddress & " -u " & username & " -p " & password & " config -g cfgIpmiPet -o cfgIpmiPetAlertEnable 1 -i " & Index & " > " & strRacadmFileOutput
logStrCommand = "cmd /C " & chr(34) & racadmPath & "\" & "racadm.exe" & Chr(34) & " -r " & DRAC_IPAddress & " -u " & username & " -p ***** config -g cfgIpmiPet -o cfgIpmiPetAlertEnable 1 -i " & Index & " > " & strRacadmFileOutput
Dim oShell, rc, timer, RunRemoteCmd
Set oShell = CreateObject ("WScript.Shell")
rc = oShell.run (strCommand,0,true)
MOMDebugLog 1, "Racadm Immediate Shell.run status = " & rc
timer = 0
Do While ((rc <> 0) OR (bFileExists(strRacadmFileOutput) <> -1))
WScript.Sleep(1000)
timer = timer + 1
If (timer > timeout) Then
MOMDebugLog 1, "Exit RunCmd. Reason: RemoteRacadm command not responding. Exiting section"
RunRemoteCmd = -1
DelFile(strRacadmFileOutput)
RunRemoteCmd = -1
logMessage = "RunRemoteCMD error: " & rc
MOMDebugLog 1, logMessage
Err.Clear
Exit Function
End If
Loop
If Not bFileExists(strRacadmFileOutput) Then
logMessage = "strRacadmFileOutput does not exist - " & strRacadmFileOutput
MOMDebugLog 1, logMessage
Exit Function
end if
MOMDebugLog 1, "-----Successfully enabled. Exiting EnableConfiguration()-------"
End Function
Function GetFreeIndex()
MOMDebugLog 1, "--------Entered GetFreeIndex()---------------"
GetRACADMPath racadmPath
If racadmPath = "" Then
LogMessage = "GetRACADMPath function Error - " & rc
MOMDebugLog 1, LogMessage
Err.Clear
Exit Function
Else
LogMessage = "GetRACADMPath:: " & racadmPath
MOMDebugLog 1, LogMessage
End If
Dim TypeLib, NewGUID, fileGuid
Set TypeLib = CreateObject("Scriptlet.TypeLib")
NewGUID = TypeLib.Guid
fileGuid= (left(NewGUID, len(NewGUID)-2))
strRacadmFileOutput = "Dell_DRAC_Trap_Cfg_" & DRAC_IPAddress & "_" & fileGuid & ".txt"
Dim logStrCommand, strCommand, objLogFSO1, oFile, strLine
Const ForReading = 1
strCommand = "cmd /C " & chr(34) & racadmPath & "\" & "racadm.exe" & Chr(34) & " -r " & DRAC_IPAddress & " -u " & username & " -p " & password & " getconfig -f config -g cfgIpmiPet > " & strRacadmFileOutput
logStrCommand = "cmd /C " & chr(34) & racadmPath & "\" & "racadm.exe" & Chr(34) & " -r " & DRAC_IPAddress & " -u " & username & " -p ****" & " getconfig -f config -g cfgIpmiPet > " & strRacadmFileOutput
Dim oShell, rc, timer, RunRemoteCmd
Set oShell = CreateObject ("WScript.Shell")
rc = oShell.run (strCommand,0,true)
MOMDebugLog 1, "Racadm Immediate Shell.run status = " & rc
timer = 0
Do While ((rc <> 0) OR (bFileExists(strRacadmFileOutput) <> -1))
WScript.Sleep(1000)
timer = timer + 1
If (timer > timeout) Then
MOMDebugLog 1, "Exit RunCmd. Reason: RemoteRacadm command not responding. Exiting section"
RunRemoteCmd = -1
DelFile(strRacadmFileOutput)
RunRemoteCmd = -1
logMessage = "RunRemoteCMD error: " & rc
MOMDebugLog 1, logMessage
Err.Clear
Exit Function
End If
Loop
If Not bFileExists(strRacadmFileOutput) Then
logMessage = "strRacadmFileOutput does not exist - " & strRacadmFileOutput
MOMDebugLog 1, logMessage
Exit Function
end if
' Logic to Parse the file
Dim cfgIpmiPetIndex, cfgIpmiPetAlertDestIpAddr, cfgIpmiPetAlertEnable
Set objLogFSO1 = CreateObject("Scripting.FileSystemObject")
Set oFile = objLogFSO1.OpenTextFile(strRacadmFileOutput, ForReading, False)
Dim PetIndex, AlertDestIpAddr, AlertEnable, lineItems, tmpStr
Dim isFirstIndex, isSecondIndex, isThirdIndex, isFourthIndex
Do While Not oFile.AtEndOfStream
strLine = Trim(oFile.ReadLine)
'MOMDebugLog 1, "***strLine:" & strLine
If Instr(Lcase(strLine),"error") Then
LogMessage = " ERROR: Error in RemoteRacadm Output " & strLine
MOMDebugLog 1, LogMessage
Err.Clear
ElseIf Instr(LCase(strLine),Lcase("ERROR: Unable to")) Then
LogMessage = " ERROR: LOGIN IP/PORT/CREDENTIAL issue: " & strLine
MOMDebugLog 1, LogMessage
Exit Function
ElseIf Instr(LCase(strLine),Lcase("cfgIpmiPetIndex")) Then
strLine = Trim(strLine)
lineItems = split(strLine,"=")
if InStr(lineItems(0), "cfgIpmiPetIndex") > 0 then
cfgIpmiPetIndex = Left(lineItems(1), Len(lineItems(1))-1) ' remove \r or \n
MOMDebugLog 1, "cfgIpmiPetIndex:" & cfgIpmiPetIndex
end if
cfgIpmiPetIndex = CInt(cfgIpmiPetIndex)
if(cfgIpmiPetIndex = 1) Then
isFirstIndex = true
elseif(cfgIpmiPetIndex = 2) Then
isSecondIndex = true
elseif(cfgIpmiPetIndex = 3) Then
isThirdIndex = true
elseif(cfgIpmiPetIndex = 4) Then
isFourthIndex = true
end if
ElseIf Instr(LCase(strLine),Lcase("cfgIpmiPetAlertDestIpAddr")) Then
strLine = Trim(strLine)
lineItems = split(strLine,"=")
cfgIpmiPetAlertDestIpAddr = Left(lineItems(1), Len(lineItems(1))-1) ' remove \r or \n
MOMDebugLog 1, "cfgIpmiPetAlertDestIpAddr:" & cfgIpmiPetAlertDestIpAddr &":"
ElseIf Instr(LCase(strLine),Lcase("cfgIpmiPetAlertEnable")) Then
strLine = Trim(strLine)
lineItems = split(strLine,"=")
cfgIpmiPetAlertEnable = Left(lineItems(1), Len(lineItems(1))-1) ' remove \r or \n
MOMDebugLog 1, "cfgIpmiPetAlertEnable:" & cfgIpmiPetAlertEnable
end if
if(StrComp(cfgIpmiPetAlertDestIpAddr, MS_IPAddress) = 0) Then
isConfigured = true
EXIT function
elseif(StrComp(cfgIpmiPetAlertDestIpAddr, "0.0.0.0") = 0) Then
freeIndex = cfgIpmiPetIndex
MOMDebugLog 1, "1.cfgIpmiPetAlertDestIpAddr:" & cfgIpmiPetAlertDestIpAddr & ",cfgIpmiPetIndex:" & cfgIpmiPetIndex
MOMDebugLog 1, "0.0.0.0: set freeIndex=" & freeIndex
EXIT function
end if
Loop
if(isFirstIndex = false) Then
freeIndex = 1
elseif(isSecondIndex = false) Then
freeIndex = 2
elseif(isThirdIndex = false) Then
freeIndex = 3
elseif(isFourthIndex = false) Then
freeIndex = 4
end if
MOMDebugLog 1, "------Exiting GetFreeIndex():freeIndex:" & freeIndex
End Function
Function ConfigDRACTrapDst()
MOMDebugLog 1, "---------Entered ConfigDRACTrapDst()-----------"
Index = freeIndex
GetRACADMPath racadmPath
If racadmPath = "" Then
LogMessage = "GetRACADMPath function Error - " & rc
MOMDebugLog 1, LogMessage
Err.Clear
Exit Function
Else
LogMessage = "GetRACADMPath:: " & racadmPath
MOMDebugLog 1, LogMessage
End If
Dim TypeLib, NewGUID, fileGuid
Set TypeLib = CreateObject("Scriptlet.TypeLib")
NewGUID = TypeLib.Guid
fileGuid= (left(NewGUID, len(NewGUID)-2))
strRacadmFileOutput = "Dell_DRAC_Trap_Cfg_" & DRAC_IPAddress & "_" & fileGuid & ".txt"
Dim logStrCommand, strCommand, objLogFSO1, oFile, strLine
Const ForReading = 1
strCommand = "cmd /C " & chr(34) & racadmPath & "\" & "racadm.exe" & Chr(34) & " -r " & DRAC_IPAddress & " -u " & username & " -p " & password & " config -g cfgIpmiPet -o cfgIpmiPetAlertDestIpAddr " & MS_IPAddress & " -i " & Index & " > " & strRacadmFileOutput
logStrCommand = "cmd /C " & chr(34) & racadmPath & "\" & "racadm.exe" & Chr(34) & " -r " & DRAC_IPAddress & " -u " & username & " -p " & "****" & " config -g cfgIpmiPet -o cfgIpmiPetAlertDestIpAddr " & MS_IPAddress & " -i " & Index & " > " & strRacadmFileOutput
Dim oShell, rc, timer, RunRemoteCmd
Set oShell = CreateObject ("WScript.Shell")
rc = oShell.run (strCommand,0,true)
MOMDebugLog 1, "Racadm Immediate Shell.run status = " & rc
timer = 0
Do While ((rc <> 0) OR (bFileExists(strRacadmFileOutput) <> -1))
WScript.Sleep(1000)
timer = timer + 1
If (timer > timeout) Then
MOMDebugLog 1, "Exit RunCmd. Reason: RemoteRacadm command not responding. Exiting section"
RunRemoteCmd = -1
DelFile(strRacadmFileOutput)
RunRemoteCmd = -1
logMessage = "RunRemoteCMD error: " & rc
MOMDebugLog 1, logMessage
Err.Clear
Exit Function
End If
Loop
If Not bFileExists(strRacadmFileOutput) Then
logMessage = "strRacadmFileOutput does not exist - " & strRacadmFileOutput
MOMDebugLog 1, logMessage
Exit Function
end if
' Logic to Parse the file
Dim cfgIpmiPetIndex, cfgIpmiPetAlertDestIpAddr, cfgIpmiPetAlertEnable
Set objLogFSO1 = CreateObject("Scripting.FileSystemObject")
Set oFile = objLogFSO1.OpenTextFile(strRacadmFileOutput, ForReading, False)
Dim PetIndex, AlertDestIpAddr, AlertEnable, lineItems, tmpStr
Dim isFirstIndex, isSecondIndex, isThirdIndex, isFourthIndex
Do While Not oFile.AtEndOfStream
strLine = Trim(oFile.ReadLine)
'MOMDebugLog 1, "strLine:" & strLine
If Instr(Lcase(strLine),"error") Then
LogMessage = " ERROR: Error in RemoteRacadm Output " & strLine
MOMDebugLog 1, LogMessage
Err.Clear
ElseIf Instr(LCase(strLine),Lcase("ERROR: Unable to")) Then
LogMessage = " ERROR: LOGIN IP/PORT/CREDENTIAL issue: " & strLine
MOMDebugLog 1, LogMessage
Exit Function
ElseIf Instr(LCase(strLine),Lcase("ERROR: Invalid")) Then
LogMessage = " ERROR: Invalid index value issue: " & strLine
MOMDebugLog 1, LogMessage
Exit Function
ElseIf Instr(LCase(strLine),Lcase("ERROR: Login failed")) Then
LogMessage = " ERROR: Login failed issue: " & strLine
MOMDebugLog 1, LogMessage
Exit Function
ElseIf Instr(LCase(strLine),Lcase("Object value modified successfully")) Then
LogMessage = " Object value modified successfully " & strLine
MOMDebugLog 1, LogMessage
Status = "Success"
end if
Loop
Status = "Success"
MOMDebugLog 1, "-------Exiting ConfigDRACTrapDst()--------"
End Function
Function CreateMOMScriptAPI
If DebugScript = False Then
Set CreateMOMScriptAPI = CreateObject("MOM.ScriptAPI")
Else
Set CreateMOMScriptAPI = New RegExp
End If
logMessage = "INFO: New MOM.ScriptAPI"
MOMDebugLog 1, logMessage
End Function
Function CreatePropertyBag(ByRef oAPI)
If DebugScript = False Then
set CreatePropertyBag = oAPI.CreatePropertyBag()
Else
Set CreatePropertyBag = New RegExp
End If
logMessage = "INFO: New Monitor Data"
MOMDebugLog 1, logMessage
End Function
Sub oInstAddValue(ByRef oBag, prop, val)
If DebugScript = False Then
Call oBag.AddValue(prop, val)
End If
logMessage = "INFO: Set " & prop & " = " & val
MOMDebugLog 1, logMessage
End Sub
Sub ReturnData (ByRef oAPI, ByRef oBag)
If DebugScript = False Then
Call oAPI.Return(oBag)
End If
logMessage = "INFO: Returning Monitor Data"
MOMDebugLog 1, logMessage
End Sub
Function CreateDiscoveryData(ByRef oAPI, ByRef SourceId, ByRef ManagedEntityId)
If DebugScript = False Then
set CreateDiscoveryData = oAPI.CreateDiscoveryData(0, SourceId, ManagedEntityId)
Else
Set CreateDiscoveryData = New RegExp
End If
logMessage = "INFO: New Discovery Data"
MOMDebugLog 1, logMessage
End Function
Function ReturnDiscoveryData (ByRef oAPI, ByRef oDiscoveryData)
If DebugScript = False Then
Call oAPI.Return(oDiscoveryData)
End If
logMessage = "INFO: Returning Discovery Data"
MOMDebugLog 1, logMessage
End Function
Sub oInstAddProperty(ByRef oInst, prop, val)
If DebugScript = False Then
Call oInst.AddProperty(prop, val)
End If
logMessage = "INFO: Set " & prop & " = " & val
MOMDebugLog 1, logMessage
End Sub
Function CreateClassInstance(ByRef oDiscoveryData, classid)
If DebugScript = False Then
set CreateClassInstance = oDiscoveryData.CreateClassInstance(classid)
Else
Set CreateClassInstance = New RegExp
End If
logMessage = "INFO: New Class Instance" & classid
MOMDebugLog 1, logMessage
End Function
Sub AddInstanceToDiscoveryData(ByRef oDiscoveryData, ByRef oInst)
If DebugScript = False Then
Call oDiscoveryData.AddInstance(oInst)
End If
logMessage = "INFO: AddInstance to Discovery Data"
MOMDebugLog 1, logMessage
End Sub
Function DebugOut(message)
If DebugScript Then WScript.Echo message
End Function
Function CreateLog(ByRef logLevel)
' Begin Logheader
If logLevel <> 0 Then
Dim fileSize, strOutFile
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 & "\DRACLogs\"& "DRAC_ConfigTrapDestination_" & DRAC_IPAddress & ".txt"
If Not objLogFSO.FileExists(strOutFile) Then
Set objLogTextFile = objLogFSO.CreateTextFile(strOutFile)
objLogTextFile.Close()
End If
fileSize = objLogFSO.GetFile(strOutFile).Size
If (fileSize > MaxFileSize) Then
Set objLogTextFile = objLogFSO.OpentextFile(strOutFile, ForWriting, True)
Else
Set objLogTextFile = objLogFSO.OpentextFile(strOutFile, ForAppending, True)
End If
logMessage = "INFO: Script - Script : Start()"
MOMDebugLog 1, logMessage
Err.Clear
End If
End Function
'******************************************************************************
'GetRACADMPath
'Function which sets the RACADM executable path either using OMSA or DRAC Tools
'******************************************************************************
Function GetRACADMPath(ByRef o_sPath)
On Error Resume Next
'Default Location having RACADM executable for OMSA and Drac Tools
Const DEF_RACADM_PATH = "C:\Program Files\Dell\SysMgt\rac5"
Dim installerPath
installerPath = ""
If (GetRACADMInstallPath (RACADM_REG_INSTALL_PATH, RACADM64_REG_INTALL_PATH, installerPath) = True) Then
o_sPath = installerPath
LogMessage = "Got RACADM path from OMSA"
MOMDebugLog 1, LogMessage
ElseIf (GetRACADMInstallPath (REM_RACADM_REG_INTALL_PATH, REM_RACADM64_REG_INTALL_PATH, installerPath) = True) Then
o_sPath = installerPath
LogMessage = "Got RACADM path from DRAC TOOLS"
MOMDebugLog 1, LogMessage
ElseIf (VerifyInstallPath(DEF_RACADM_PATH) = True) Then
o_sPath = DEF_RACADM_PATH
LogMessage = "Got RACADM path using the Default RACADM path : " & DEF_RACADM_PATH
MOMDebugLog 1, LogMessage
Else
LogMessage = "Did Not Get RACADM Path from either OMSA or DRAC Tools"
MOMDebugLog 1, LogMessage
End If
If Err <> 0 Then
GetRACADMPath = Err.Number
Err.Clear
End If
End Function
'*********************************************************************
'GetRACADMInstallPath
'This Function sets the RACADM installer path using the Registry Key
'*********************************************************************
Function GetRACADMInstallPath (ByVal RACADM32RegistryKey, ByVal RACADM64RegistryKey, ByRef o_sPath)
On Error Resume Next
Dim installPath
installPath = ""
If (GetPathFromRegistry (RACADM32RegistryKey, installPath) = True) Then
o_sPath = installPath
GetRACADMInstallPath = True
LogMessage = "Got RACADM path from RACADM 32 bit Registry Key entry : " & installPath
MOMDebugLog 1, LogMessage
ElseIf (GetPathFromRegistry (RACADM64RegistryKey, installPath) = True) Then
o_sPath = installPath
GetRACADMInstallPath = True
LogMessage = "Got RACADM path from RACADM 64 bit Registry Key entry : " & installPath
MOMDebugLog 1, LogMessage
Else
GetRACADMInstallPath = False
LogMessage = "Unable to get RACADM path for Registry Entries"
MOMDebugLog 1, LogMessage
End If
If Err <> 0 Then
GetRACADMInstallPath = Err.Number
Err.Clear
End If
On Error Goto 0
End Function
'****************************************************************************
'GetPathFromRegistry
'Function to fetch the RACADM executable path using the RACADM Registry Key
'****************************************************************************
Function GetPathFromRegistry (ByVal strRacadmKey, ByRef installPath)
On Error Resume Next
Dim oShell, pathFromRegistry, newInstallPath
'Appending 5 to the path since the RACADM executable was placed under the RAC5 directory from OM 6.0
newInstallPath = pathFromRegistry & "5"
If pathFromRegistry <> "" Then
If (VerifyInstallPath(pathFromRegistry) = True) Then
installPath = pathFromRegistry
GetPathFromRegistry = True
ElseIf (VerifyInstallPath(newInstallPath) = True) Then
installPath = newInstallPath
GetPathFromRegistry = True
Else
GetPathFromRegistry = False
End If
Else
GetPathFromRegistry = False
If Err <> 0 Then
LogMessage = "RACADM Registry is empty for Key :" & strRacadmKey
MOMDebugLog 1, LogMessage
Err.Clear
End If
End If
Set oShell = Nothing
End Function
'*********************************************************************************
'VerifyInstallPath
'The Function tells if the RACADM executable exists in the specified path or not
'*********************************************************************************
Function VerifyInstallPath (path)
On Error Resume Next
Dim installPath
installPath = path & "\racadm.exe"
If (bFileExists(installPath)) Then
VerifyInstallPath = True
else
VerifyInstallPath = False
End If
End Function
'*****************************************************************
'bFileExists
'Routine to determine if a file exists (omconfig/omreport)
'*****************************************************************
Function bFileExists(filespec1)
On Error Resume Next
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
bFileExists = (fso.FileExists(filespec1))
Set fso = Nothing
On Error Goto 0
End Function
'*****************************************************************
'DelFile
'Routine to delete the OMSA Report file
'*****************************************************************
Function DelFile(ByVal filespec2)
On Error Resume Next
Dim fso, oFile
If bFileExists(filespec2) Then
Set fso = CreateObject("Scripting.FileSystemObject")
fso.DeleteFile filespec2, True
Set fso = Nothing
End If
If Err <> 0 Then
DelFile = Err.Number
Err.Clear
End If
On Error Goto 0
End Function
'*****************************************************************
'RemoveWhiteSpaces
'Routine to
'*****************************************************************
Function RemoveWhiteSpace(ByVal strText)
Dim RegEx
Set RegEx = New RegExp
RegEx.Pattern = "\s+"
RegEx.MultistrLine = True
RegEx.Global = True
strText = RegEx.Replace(strText, " ")
RemoveWhiteSpace = strText
End Function