On Error Resume Next Set IISOBJ = getObject("IIS://localhost/W3SVC") For Each Web in IISOBJ If (CLng(Web.Name) > 1) Then If (Web.ServerStatus = 2) Then Set WebSite = getObject("IIS://localhost/W3SVC/" & Web.Name) Set WebSiteRoot = getObject("IIS://localhost/W3SVC/" & Web.Name & "/root") Set oWSHShell = Wscript.CreateObject("Wscript.Shell") HomeDir = WebSiteRoot.Path LogDir = oWSHShell.ExpandEnvironmentStrings(WebSite.LogFileDirectory) LogDir = LogDir & "\W3SVC" & Web.Name retval = InStr("W3SVCInfo", HomeDir) If retval = 0 Then StatsDir = HomeDir & "\logs" retval = InStr(1,LogDir,HomeDir,1) If retval = 0 Then NewLogDir = HomeDir & "\logs\W3SVC" & Web.Name Dim FSO Set FSO = WScript.CreateObject("Scripting.FileSystemObject") ' Create the new directory If Not (FSO.FolderExists(NewLogDir)) Then FSO.CreateFolder(NewLogDir) End If ' Point them to the new directory & set to monthly WebSite.LogFileDirectory = StatsDir WebSite.LogFilePeriod = 3 WebSite.SetInfo ' Move their files Set FolderObj = FSO.GetFolder(LogDir) For Each File in FolderObj.Files File.Move(NewLogDir & "\") Next Set FolderObj = Nothing Set FSO = Nothing LogDir = NewLogDir End If ' Now test for 1st of month sDay = Day(Date) sMonth = Month(Date) sYear = Year(Date) If sDay = "1" Then If sMonth = "1" Then slastMonth = "12" slastYear = Year(Date) - 1 Else slastMonth = sMonth - 1 If (sLlastMonth < 10) Then slastMonth = "0" & CStr(sLastMonth) End If slastYear = sYear End If slastYear = Right(slastYear, 2) sRunString = "C:\tools\analog\analog.exe " & LogDir & "\ex" & slastYear & slastMonth & ".log " sRunString = sRunString & "+O" & StatsDir & "\analog.dat " sRunString = sRunString & "+C""BASEURL http://" & Web.ServerComment & "/"" " sRunString = sRunString & "+C""CACHEOUTFILE " & LogDir & "\cache." & slastYear & slastMonth & """" oWSHShell.Run sRunString,7,1 End If If (sMonth < 10) Then sMonth = "0" & CStr(sMonth) End If ' Run analog sRunString = "c:\tools\analog\analog.exe " & LogDir & "\ex" & Right(sYear, 2) & sMonth & ".log " sRunString = sRunString & "+U" & LogDir & "\cache.* " sRunString = sRunString & "+O" & StatsDir & "\analog.dat " sRunString = sRunString & "+C""BASEURL http://" & Web.ServerComment & "/""" oWSHShell.Run sRunString,7,1 ' Run RMAGIC sRunString = "C:\tools\rmagic\rmagic.exe C:\tools\rmagic\rmagic.ini " sRunString = sRunString & "-statistics_File_In=" & StatsDir & "\analog.dat " sRunString = sRunString & "-reports_File_Out=" & StatsDir & "\ " sRunString = sRunString & "-website_Base_URL=http://" & Web.ServerComment & "/" oWSHShell.Run sRunString,7,1 End If Set oWSHShell = Nothing Set WebSiteRoot = Nothing Set WebSite = Nothing End If End If Next Set IISOBJ = Nothing