'***************************************************************************************************************************************
' P Juster's basic script to read the contents of an IIS log file and translate the Vault Cache synchronisation string using
'appendix E found in ftp://ftp.entsupport.symantec.com/pub/support/products/Exchange_Mailbox_Archiving_Unit/347092.pdf
'
'
'
' Please search this file for "outputfile" as this variable details where the output report is created, be default is it "c:\vcstatus-originalfilename.html"
'
'
'Version 0.3
'***************************************************************************************************************************************
'functions are denoted by '+++++++++++++++++++++++++++++++++++++++++++++++++++++
Option Explicit
'general variables
DIM ObjFSO, InitFSO, objoutputTextFile,objShell
dim strLine1, arrRecord1, objFSO1, objTextFile1,strLinetoParse, strLinetoParse2
dim MDCarraya,MDCarrayb,CCarraya,CCarrayb,MDCarraynum,ccarraynum
dim counter, matchfound,aa
Dim MSt,CSt,Ls,Ci,Td 'VCstatus
Dim strbeg, strend, outputfile, evclientver, strText,arrtext,i
MDCarraya = Array("mdcSyncStatusFailedEmptyArchive","mdcSyncStatusFailedServerSyncing","mdcSyncStatusPrevented","mdcSyncStatusFailedInsufficientDisk","mdcSyncStatusFailedSlot","mdcSyncStatusFailedCouldNotConnectToEVWebServerVirtDir","mdcSyncStatusFailedOffline","mdcSyncStatusFailedDirty","mdcSyncStatusFailed","mdcSyncStatusSuccess","mdcSyncStatusNone","mdcSyncStatusPending","mdcSyncStatusInProgress","mdcSyncStatusInProgressAcquireSlot","mdcSyncStatusInProgressAcquireSlotWaiting","mdcSyncStatusReset","mdcSyncStatusSuspended","mdcSyncStatusShutdown")
MDCarrayb = Array("MSt=-9","MSt=-8","MSt=-7","MSt=-6","MSt=-5","MSt=-4","MSt=-3","MSt=-2","MSt=-1","MSt=0","MSt=10","MSt=19","MSt=20","MSt=30","MSt=31","MSt=2147483645","MSt=2147483646","MSt=2147483646")
MDCarraynum = 19
CCarraya = Array("CC_INITIALIZING","CC_NEVER_DOWNLOADED","CC_NODOWNLOAD","CC_COMPLETE","CC_DBBUILDING","CC_DBDOWNLOADING","CC_RETRY_WEBSERVER","CC_BITS_NOT_AVAILABLE","CC_FAILED_FIRST_DBBUILD","CC_FAILED_NEXT_DBBUILD","CC_FAILED_BITS_DOWNLOAD","CC_FAILED_PROCESS_NEXT_ARCHIVE","CC_FAILED_ADDING_ARCHIVES","CC_FAILED_WEBSERVER","CC_FAILED_GENERIC")
CCarrayb = Array("CSt=0","CSt=1","CSt=2","CSt=3","CSt=4","CSt=5","CSt=100","CSt=200","CSt=300","CSt=301","CSt=302","CSt=303","CSt=304","CSt=305","CSt=400")
ccarraynum = 15
If (Wscript.Arguments.Count < 1) Then 'has dss been run with a parameter ? if not then open the dialogue box
Set ObjFSO = CreateObject("UserAccounts.CommonDialog")
ObjFSO.Filter = "log files|*.log|Text Documents|*.txt|All Files|*.*"
ObjFSO.FilterIndex = 3
ObjFSO.InitialDir = "C:\Case info\college academy\LOGs\LOGs"
InitFSO = ObjFSO.ShowOpen
If InitFSO = False Then
' Wscript.Echo "Script Error: Please select a file!"
Wscript.Quit
Else
' Wscript.Echo "You selected the file: " & ObjFSO.FileName
'getting the filename selected to us for the output filename
strText = ObjFSO.FileName
arrText = Split(strText, "\")
For i = 0 to Ubound(arrText)
strText = arrText(i)
Next
End If
strText = Left(strText,LEN(strText)-4)
end if
'******************************
outputfile = "c:\vcstatus-" & strtext & ".html"
'******************************
StrLinetoParse =""
Set objFSO1 = CreateObject("Scripting.FileSystemObject")
Set objoutputTextFile = objFSO1.CreateTextFile (outputfile, True)
objoutputTextFile.WriteLine "
"
objoutputTextFile.WriteLine "" & "User" & " | " & "Header Sync Status" & " | " & "Content Sync Status" & " | " & "Last Sync Time" & " | " & "Number of Items in Content Cache " & " | " & "Total Number of items to download" & " | " & "Client IP address" & " | " & " EV Client Version" & " |
"
Set objFSO1 = CreateObject("Scripting.FileSystemObject")
Set objTextFile1 = objFSO1.OpenTextFile(ObjFSO.FileName)
Do Until objTextFile1.AtEndOfStream
strLine1 = objtextFile1.ReadLine
'wscript.echo strLine1
if InStr(strLine1,"&Slot=")Then
if InStr(strLine1,"&MSt=")Then
arrRecord1 = split(strLine1, " ") 'this splits the IIS lines into columns deliminated by spaces.
'objoutputTextFile.WriteLine "*************"
'''''''''''''''''''''''''''''objoutputTextFile.WriteLine arrRecord1(0) & " *** " & arrRecord1(6) & " *** " & arrRecord1(8)
strLinetoParse = arrRecord1(6)
strend = (Len(strLinetoParse))
strbeg = instr (strLinetoParse, "MSt")
strLinetoParse = Mid(strLinetoParse,strbeg,strend)
strLinetoParse2 = split(strLinetoParse, "&")
MSt= strLinetoParse2(0)
call convertmdc (strLinetoParse2(0))
MSt=aa
CSt= strLinetoParse2(1)
call convertcc (strLinetoParse2(1))
CSt=aa
Ls= strLinetoParse2(2)
Ls= RIGHT(Ls,LEN(Ls)-3)
Ci= strLinetoParse2(3)
Ci= RIGHT(Ci,LEN(Ci)-3)
Td= strLinetoParse2(4)
Td= RIGHT(Td,LEN(Td)-3)
evclientver = arrRecord1(10)
evclientver = RIGHT(evclientver,LEN(evclientver)-26)
objoutputTextFile.WriteLine "" & arrRecord1(8) & " | " & MSt & " | " & Cst & " | " & Ls & " | " & Ci & " | " & Td & " | " & arrRecord1(9) & " | " & evclientver & " |
"
'
End If
End If
Loop
objoutputTextFile.WriteLine "
"
' --------------------------
' opens output file.
Set objShell = CreateObject("WScript.Shell")
objShell.Run("iexplore.exe " & outputfile)
' --------------------------
' find MSt and then use the startin gposition to then find the next " " to then get a string to manipulate.
'2010-10-19 10:51:54 W3SVC1 192.168.30.22 GET /EnterpriseVault/Slot.aspx ArchiveID=1D3B5EEA4D4251B4DA353003F3B63F7BF1110000evserver&Slot=a4e35f2c-c69b-4970-a673-a9f76e3bf180&release=true&MSt=0&CSt=3&Ls=2010-10-19T10:51:52&Ci=2981&Td=0 443 HDQ\ilan 192.168.50.179 EnterpriseVaultOutlookExt-V8.0.3.1845 200 0 0
'ArchiveID=1D3B5EEA4D4251B4DA353003F3B63F7BF1110000evserver&Slot=a4e35f2c-c69b-4970-a673-a9f76e3bf180&release=true&MSt=0&CSt=3&Ls=2010-10-19T10:51:52&Ci=2981&Td=0
'MSt=0&CSt=3&Ls=2010-10-19T10:51:52&Ci=2981&Td=0
'HDQ\ilan 192.168.50.179
'MSt: header cache status
'mdcSyncStatusFailedEmptyArchive -9
'mdcSyncStatusFailedServerSyncing -8
'mdcSyncStatusPrevented -7
'mdcSyncStatusFailedInsufficientDisk -6
'mdcSyncStatusFailedSlot -5
'mdcSyncStatusFailedCouldNotConnectToEVWebServerVirtDir -4
'mdcSyncStatusFailedOffline -3
'mdcSyncStatusFailedDirty -2
'mdcSyncStatusFailed -1
'mdcSyncStatusSuccess 0
'mdcSyncStatusNone 10
'mdcSyncStatusPending 19
'mdcSyncStatusInProgress 20
'mdcSyncStatusInProgressAcquireSlot 30
'mdcSyncStatusInProgressAcquireSlotWaiting 31
'mdcSyncStatusReset 2147483645
'mdcSyncStatusSuspended 2147483646
'mdcSyncStatusShutdown 2147483647
'
'CSt: content cache status
'CC_INITIALIZING 0
'CC_NEVER_DOWNLOADED CC_INITIALIZING + 1
'CC_NODOWNLOAD CC_NEVER_DOWNLOADED + 1
'CC_COMPLETE CC_NODOWNLOAD + 1
'CC_DBBUILDING CC_COMPLETE + 1
'CC_DBDOWNLOADING CC_DBBUILDING + 1
'CC_RETRY_WEBSERVER 100
'CC_BITS_NOT_AVAILABLE 200
'CC_FAILED_FIRST_DBBUILD 300
'CC_FAILED_NEXT_DBBUILD CC_FAILED_FIRST_DBBUILD + 1
'CC_FAILED_BITS_DOWNLOAD CC_FAILED_NEXT_DBBUILD + 1
'CC_FAILED_PROCESS_NEXT_ARCHIVE CC_FAILED_BITS_DOWNLOAD + 1
'CC_FAILED_ADDING_ARCHIVES CC_FAILED_PROCESS_NEXT_ARCHIVE + 1
'CC_FAILED_WEBSERVER CC_FAILED_ADDING_ARCHIVES + 1
'CC_FAILED_GENERIC 400
'
'Ls: last sync time YYYY-MM-DDTHH:MM:SS
'CI: number of items in the content cache Integer
'Td: total number of items to download Integer
'+++++++++++++++++++++++++++++++++++++++++++++++++++++
function convertmdc(ss)
'ss is the value to convert to MDCstring
counter=0 ' counter used to check if a match has been found or not.
matchfound = 0
'if aa = 1 then
''ccver = "" 'reset output value
do while counter < MDCarraynum ' total number of entries in each of the arrays add a product version increment this number
if MDCarrayb(counter) = ss then
aa = MDCarraya(counter)
matchfound = 1
Exit Do
Elseif matchfound = 0 then
aa = "unable to determine"
End If
counter = counter + 1
loop
end function
'+++++++++++++++++++++++++++++++++++++++++++++++++++++
'+++++++++++++++++++++++++++++++++++++++++++++++++++++
function convertcc(ss)
'ss is the value to convert to CCstring
counter=0 ' counter used to check if a match has been found or not.
matchfound = 0
'if aa = 1 then
''ccver = "" 'reset output value
do while counter < CCarraynum ' total number of entries in each of the arrays add a product version increment this number
if CCarrayb(counter) = ss then
aa = CCarraya(counter)
matchfound = 1
Exit Do
Elseif matchfound = 0 then
aa = "unable to determine"
End If
counter = counter + 1
loop
end function
'+++++++++++++++++++++++++++++++++++++++++++++++++++++