Option Explicit dim LogFileDirectory dim Folders() dim Sites() dim Valid() function EnumerateFolders() Dim FSO, Dir, File, Index set FSO = createobject("Scripting.FileSystemObject") set Dir = fso.GetFolder(LogFileDirectory) redim Folders(Dir.SubFolders.Count) redim Valid(Dir.SubFolders.Count) Index =0 for each File in Dir.SubFolders if (left(File.Name,5) = "W3SVC") then Folders(Index) = File.Name Valid(Index) = false Index = Index+1 end if next redim Preserve Folders(Index-1) redim Preserve Valid(Index-1) set Dir = Nothing set FSO = Nothing end function function DisplayFolders() dim Folder, Index, Bad Bad = 0 for Index= 0 to UBound(Folders) if (Valid(Index) = false) then Bad = Bad + 1 WScript.echo LogFileDirectory & "\" & Folders(Index) end if next if (Bad = 0) then WScript.echo "There are no Log directories found that are not associated with IIS" else WScript.echo "" WScript.echo Bad & " directories were found..." end if end function function EnumerateSites() Dim IISObj, Web, Index Index = 0 Set IISOBJ = getObject("IIS://localhost/w3svc") for each Web in IISOBJ if (Web.Class = "IIsWebServer") then Index = Index + 1 redim Preserve Sites(Index) Sites(Index) = "W3SVC" & Web.Name end if next Set IISOBj=Nothing end function Function ProcessFolders() dim Folder, Index, fIndex for Index = 0 to UBound(Sites) for fIndex= 0 to UBound(Folders) if (Sites(Index) = Folders(fIndex)) then Valid(fIndex) = true end if next next end Function function GetDefaultLogFolderPath Dim IISObj Set IISOBJ = getObject("IIS://localhost/w3svc") LogFileDirectory = IISObj.LogFileDirectory Set IISOBj = Nothing end function function WriteHeader WScript.Echo "The following directories are no longer associated with any IIS Web Sites." WScript.Echo "" end function call WriteHeader call GetDefaultLogFolderPath call EnumerateFolders call EnumerateSites call ProcessFolders call DisplayFolders