Rambeaux007
IS-IT--Management
I am trying to work out a script that will read multiple log files on multiple computers. I just can't seem to figure out how to get this accomplished. Here is the code I have so far....
strComputers = objFile.ReadAll
objFile.Close
arrComputers = Split(strComputers, vbCrLf)
For Each strComputer In arrComputers
Set objRegEx = CreateObject("VBScript.RegExp")
objRegEx.Global = True
objRegEx.Pattern = "[0-9]{1,3}.[0-9]{1,3}"
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists("\\" & strComputer & "\c$\Test.log") Then
Set objFile = objFSO.OpenTextFile("\\" & strComputer & "\Test.log", ForReading)
strSearchString = objFile.ReadAll
objFile.Close
Set colMatches = objRegEx.Execute(strSearchString)
If colMatches.Count > 0 Then
For Each strMatch in colMatches
strMatch2 = strMatch.value
Next
End If
'*************************************************************************************
Call Show(strComputer, strMatch2)
'*************************************************************************************
End If
strComputers = objFile.ReadAll
objFile.Close
arrComputers = Split(strComputers, vbCrLf)
For Each strComputer In arrComputers
Set objRegEx = CreateObject("VBScript.RegExp")
objRegEx.Global = True
objRegEx.Pattern = "[0-9]{1,3}.[0-9]{1,3}"
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists("\\" & strComputer & "\c$\Test.log") Then
Set objFile = objFSO.OpenTextFile("\\" & strComputer & "\Test.log", ForReading)
strSearchString = objFile.ReadAll
objFile.Close
Set colMatches = objRegEx.Execute(strSearchString)
If colMatches.Count > 0 Then
For Each strMatch in colMatches
strMatch2 = strMatch.value
Next
End If
'*************************************************************************************
Call Show(strComputer, strMatch2)
'*************************************************************************************
End If