'***************************************************************************************************************************************
' 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
'
'
'
' The output file is created in the C:\location called "vcstatus-.....html"
'
'
'Version 0.5
' This version works for IIS 7
' to run this version run vcstatus.vbs
'
'c:\Users\admin\Desktop\VCstatus.vbs c:\inetpub\logs\LogFiles\W3SVC1\u_in111020.log
'
'This script will only run correctl if the columns headings in the IIS log is int he following format and order
'
'#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status time-taken
'
'***************************************************************************************************************************************
'functions are denoted by '+++++++++++++++++++++++++++++++++++++++++++++++++++++
Option Explicit
'general variables
DIM ObjFSO, objFSO2, 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
'******************************
outputfile = "c:\vcstatus-" & strtext & ".html"
'******************************
objFSO1 = Wscript.Arguments(0)
objTextFile1 = Wscript.Arguments(0)
'wscript.echo objFSO1
StrLinetoParse =""
Set objFSO1 = CreateObject("Scripting.FileSystemObject")
Set objoutputTextFile = objFSO1.CreateTextFile (outputfile, True)
objoutputTextFile.WriteLine "
"
objoutputTextFile.WriteLine "| " & "Date" & " | " & "Time" & " | " & "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)
Set objFSO1 = CreateObject("Scripting.FileSystemObject")
Set objTextFile1 = objFSO1.OpenTextFile(Wscript.Arguments(0))
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.
strLinetoParse = arrRecord1(5)
'wscript.echo strlinetoparse
strend = (Len(strLinetoParse))
'wscript.echo strend
strbeg = instr (strLinetoParse, "MSt")
'wscript.echo strbeg
strLinetoParse = Mid(strLinetoParse,strbeg,strend)
strLinetoParse2 = split(strLinetoParse, "&")
MSt= strLinetoParse2(0)
'wscript.echo MSt
call convertmdc (strLinetoParse2(0))
MSt=aa
CSt= strLinetoParse2(1)
'wscript.echo CSt
call convertcc (strLinetoParse2(1))
CSt=aa
Ls= strLinetoParse2(2)
'wscript.echo ls
Ls= RIGHT(Ls,LEN(Ls)-3)
Ci= strLinetoParse2(3)
'wscript.echo ci
Ci= RIGHT(Ci,LEN(Ci)-3)
Td= strLinetoParse2(4)
'wscript.echo td
Td= RIGHT(Td,LEN(Td)-3)
'wscript.echo td
evclientver = arrRecord1(9)
evclientver = RIGHT(evclientver,LEN(evclientver)-26)
'objoutputTextFile.WriteLine "| Date | Time | " & arrRecord1(8) & " | " & MSt & " | " & Cst & " | " & Ls & " | " & Ci & " | " & Td & " | " & arrRecord1(9) & " | " & evclientver & " |
"
objoutputTextFile.WriteLine "| " & arrRecord1(0) & " | " & arrRecord1(1) & " | " & arrRecord1(7) & " | " & MSt & " | " & Cst & " | " & Ls & " | " & Ci & " | " & Td & " | " & arrRecord1(8) & " | " & 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
'+++++++++++++++++++++++++++++++++++++++++++++++++++++