Rambeaux007
IS-IT--Management
This script executes the HPONCFG.exe then parses thru it's output. The problem lies when I try to filter out the information between the quotes. (<IP_ADDRESS VALUE = "100.148.8.182"/>) I need to get the regexp working so I can get the information out of the quotes. Not just for IP but other information as well. Can someone assist me? If strings work but they don't filter out all the other characters.
Option Explicit
Dim strComputers, INPUT_FILE_NAME
Dim ObjShell
Dim strCurrentLine
Dim FileFSO,objFile
Dim objRegEx
Dim IP_Address, colMatches
On Error Resume Next
'*********************************************************************************
Set ObjShell = CreateObject("WScript.Shell")
'Executes HPONCFG.exe in order to gather iLO config
ObjShell.Run("%comspec% /c hponcfg /W c:\Verify\%computername%_iLO.txt"), 1, True
'*********************************************************************************
'INPUT_FILE_NAME = Server List Location
INPUT_FILE_NAME = "c:\Verify\iLO.txt"
Const FOR_READING = 1
Set FileFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = FileFSO.OpenTextFile(INPUT_FILE_NAME, FOR_READING)
'**********************************************************************************
Do Until objFile.AtEndOfStream
strCurrentLine = objFile.ReadLine
If InStr(strCurrentLine, "<IP_ADDRESS VALUE") <> 0 Then
Set objRegEx = New RegExp
'Sets Pattern for lookup
objRegEx.Pattern = "\[((\d+\.){3}\d+)\]"
Set colItems = objRegEx.Execute(strCurrentLine)
If colMatches.Count > 0 Then
For Each objItem In colItems
WScript.Echo ObjItem.SubMatches(0)
Next
End If
Elseif InStr(strCurrentLine, "<GATEWAY_IP_ADDRESS") <> 0 Then
wscript.echo strCurrentLine
Elseif InStr(strCurrentLine, "NIC_SPEED VALUE") <> 0 Then
wscript.echo strCurrentLine
Elseif InStr(strCurrentLine, "<FULL_DUPLEX VALUE") <> 0 Then
wscript.echo strCurrentLine
Elseif InStr(strCurrentLine, "<DNS_NAME VALUE =") <> 0 Then
wscript.echo strCurrentLine
Elseif InStr(strCurrentLine, "USER_NAME =") <> 0 Then
wscript.echo strCurrentLine
Elseif InStr(strCurrentLine, "<PRIM_DNS_SERVER") <> 0 Then
wscript.echo strCurrentLine
End If
Loop
objFile.Close
Option Explicit
Dim strComputers, INPUT_FILE_NAME
Dim ObjShell
Dim strCurrentLine
Dim FileFSO,objFile
Dim objRegEx
Dim IP_Address, colMatches
On Error Resume Next
'*********************************************************************************
Set ObjShell = CreateObject("WScript.Shell")
'Executes HPONCFG.exe in order to gather iLO config
ObjShell.Run("%comspec% /c hponcfg /W c:\Verify\%computername%_iLO.txt"), 1, True
'*********************************************************************************
'INPUT_FILE_NAME = Server List Location
INPUT_FILE_NAME = "c:\Verify\iLO.txt"
Const FOR_READING = 1
Set FileFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = FileFSO.OpenTextFile(INPUT_FILE_NAME, FOR_READING)
'**********************************************************************************
Do Until objFile.AtEndOfStream
strCurrentLine = objFile.ReadLine
If InStr(strCurrentLine, "<IP_ADDRESS VALUE") <> 0 Then
Set objRegEx = New RegExp
'Sets Pattern for lookup
objRegEx.Pattern = "\[((\d+\.){3}\d+)\]"
Set colItems = objRegEx.Execute(strCurrentLine)
If colMatches.Count > 0 Then
For Each objItem In colItems
WScript.Echo ObjItem.SubMatches(0)
Next
End If
Elseif InStr(strCurrentLine, "<GATEWAY_IP_ADDRESS") <> 0 Then
wscript.echo strCurrentLine
Elseif InStr(strCurrentLine, "NIC_SPEED VALUE") <> 0 Then
wscript.echo strCurrentLine
Elseif InStr(strCurrentLine, "<FULL_DUPLEX VALUE") <> 0 Then
wscript.echo strCurrentLine
Elseif InStr(strCurrentLine, "<DNS_NAME VALUE =") <> 0 Then
wscript.echo strCurrentLine
Elseif InStr(strCurrentLine, "USER_NAME =") <> 0 Then
wscript.echo strCurrentLine
Elseif InStr(strCurrentLine, "<PRIM_DNS_SERVER") <> 0 Then
wscript.echo strCurrentLine
End If
Loop
objFile.Close