'Alan dot Kaplan at VA dot Gov '6/7/2010, 7/28/10 'Creates a filter to be used by ISA server to capture all traffic to an IP during an interval of time. 'Tested only with ISA 2004 Standalone Cached mode 'You can run this interactively or from commandline, example: 'CreateDestinationAndTimeFilter /start:"6/7/2010 7:00:00 AM" /end:"6/7/2010 5:30:00 PM" /IP:192.168.100.65 Option Explicit dim quote quote=chr(34) Dim scriptpath dim sDate, sTime, strStart, StrStartValue Dim eDate, eTime, strEnd, strEndValue, strIP Dim strText, strTxtFileName, objTXTFile Dim bTimeFormat, bTimeFormatokay dim wshShell Set wshShell = WScript.CreateObject("WScript.Shell") If WScript.Arguments.Named.Count <> 3 Then PromptArgs Else strStart = WScript.Arguments.Named("Start") strEnd = WScript.Arguments.Named("End") eDate = FormatDateTime(CDate(strEnd),vbShortDate) strIP = WScript.Arguments.Named("IP") End If StrStartValue = GetDbl(cDate(strStart)) strEndValue = GetDbl(cDate(strEnd)) 'get path name, ending in \ scriptpath = Left(Wscript.ScriptFullName, InStrRev(Wscript.ScriptFullName, "\")) 'this will create a file called DestinationAndTimeFilter.xml" dim fso Set fso = CreateObject("Scripting.FileSystemObject") 'set objTXTFile = fso.opentextfile(strTXTfilename, 8, true) strText = ""& _ "" & _ "" & _ "" & _ "" & _ "" & _ "" & _ "" & _ "" & _ "" & _ "" & _ "" & _ "" & _ "" & _ "" & _ "" & _ "" & _ "" & _ "" & _ "" & _ "" & _ "" & _ "" & _ "" & VbCrLf strTXTfilename=scriptpath & Month(cDate(edate)) & "_" & Day(cDate(edate)) & "_" & Year(cDate(edate))& "_" & replace(strip,".","_") & "_DestinationAndTimeFilter.xml" If fso.FileExists(strtxtfilename) Then fso.DeleteFile(strTxtFileName) Set objTxtFile = fso.CreateTextFile(strTXTFileName) objTXTFile.writeline (strText) objTXTFile.close wshShell.Popup "Wrote " & strTxtFileName, 5,"Filter Created" Function GetDbl (strDateTime) GetDbl = CDbl(CDate(strDateTime)) End Function Sub OkayTimeFormat(strTime) Dim arrCount, charCount arrCount = Split(strTime,":") CharCount = UBound(arrCount) arrCount = Empty If (charCount< 2) Or (instr(strTime,"M") = 0) Then wshshell.popup "Time must include seconds and AM/PM, example: 2:35:00 PM" bTimeFormatokay = False Else bTimeFormatokay = True End If End Sub Sub PromptArgs sTime = Time eTime = DateAdd("h", 1, time) Dim bTimeFormatokay sDate = InputBox("Enter the date you want to start the log search in the format below:","Start Date", FormatDateTime(Date-7, vbShortDate )) if sDate = "" Then WScript.Quit bTimeFormatokay = True Do sTime = InputBox("Enter the time you want to start the log search in the format below:","Start Time", FormatDateTime(Time, vbLongTime )) If sTime = "" Then WScript.Quit OkayTimeFormat(sTime) Loop While bTimeFormatokay= False strStart = sDate & Space(1) & sTime bTimeFormatokay = True Do eDate = InputBox("Enter the date you want to end the log search in the format below:","End Date", sDate) If eDate = "" Then WScript.Quit OkayTimeFormat (eTime) Loop While bTimeFormatokay = False eTime = InputBox("Enter the time you want to end searching in the format below:","End Time", Time) If eTime = "" Then WScript.Quit strEnd= eDate & Space(1) & eTime strIP = InputBox("What is the destination IP to filter","IP") If strIP = "" Then WScript.Quit End Sub