ActiveXperts Network Monitor
Monitor servers, workstations, devices and applications in your network

Quicklinks


NOTE: ActiveXperts Network Monitor ships with a large collection of VBScript scripts to monitor any aspect of your network. Most VBScript scripts also have a PowerShell implementation. Download Now »


Scripts to manage Plain Text Logs

Parsing a Fixed Width Column Log
Parsing a Comma Separated Values Log

Parsing a Fixed Width Column Log


Extracts the information in the NetSetup log to individual fields and records.
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("C:\Windows\Debug\Netsetup.log", _
    ForReading)
Do While objTextFile.AtEndOfStream <> True
    strLinetoParse = objTextFile.ReadLine
    dtmEventDate = Mid(strLinetoParse, 1, 6)
    dtmEventTime = Mid(strLinetoParse, 7, 9)
    strEventDescription = Mid(strLinetoParse, 16)
    Wscript.Echo "Date: " & dtmEventDate
    Wscript.Echo "Time: " & dtmEventTime
    Wscript.Echo "Description: " & strEventDescription & VbCrLf
Loop
objFSO.Close

Parsing a Comma Separated Values Log


Extracts the information in the DHCP Server log to individual fields and records.
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("C:\Windows\System32\DHCP\" _
    & "DhcpSrvLog-Mon.log", ForReading)
Do While objTextFile.AtEndOfStream <> True
    If inStr(objtextFile.Readline, ",") Then
        arrDHCPRecord = split(objTextFile.Readline, ",")
        wscript.echo "Event ID: " & arrDHCPRecord(0)
        wscript.echo "Date: " & arrDHCPRecord(1)
        wscript.echo "Time: " & arrDHCPRecord(2)
        wscript.echo "Description: " & arrDHCPRecord(3)
        wscript.echo "IP Address: " & arrDHCPRecord(4)
        wscript.echo "Host Name: " & arrDHCPRecord(5)
        wscript.echo "MAC Address: " & arrDHCPRecord(6)
    Else
        objTextFile.Skipline
    End If
    i = i + 1
Loop