Created
April 8, 2019 17:53
-
-
Save bohack/6871578bcf8d7d30f05e5f8aebda8971 to your computer and use it in GitHub Desktop.
VM Log Parser for VM Deletion Script.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' Jon Buhagiar | |
' 03/29/19 | |
' Parses the log file of machines deleted | |
' Use this command first to remove interleave formatting | |
' TYPE log.txt > log2.txt | |
Option Explicit | |
Dim objFile, strLine, strInFile | |
Dim objFSO, intCNT, strOutput | |
WScript.Echo "Make sure to clean the file with type logxxxx.txt > logyyyy.txt before using this" | |
strInFile = WScript.Arguments.Item(0) | |
Set objFSO = CreateObject("Scripting.FileSystemObject") | |
Set objFile= objFSO.OpenTextFile(strInFile, 1) | |
Do While Not objFile.AtEndOfStream | |
strLine = objFile.readline | |
If left(strLine,8) = "Deleting" Then | |
intCNT = 0 | |
Do While intCNT < 4 | |
strLine = objFile.readline | |
intCNT = intCNT + 1 | |
Loop | |
strOutput = trim(Left(strLine,20)) & "," & Mid(strLine,22,10) | |
strLine = objFile.readline | |
intCNT = 0 | |
Do While intCNT < 2 | |
strLine = objFile.readline | |
intCNT = intCNT + 1 | |
Loop | |
strOutput = strOutput & "," & Mid(strLine,15,10) | |
WScript.Echo strOutput | |
End If | |
Loop | |
objFile.Close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment