function EnumVirtualDirectories(Level, MachineName, ObjectPath, DirStyle) Dim ChildObject, IISObkect on error resume next Err.Clear IIsObjectPath = "IIS://" & MachineName If (ObjectPath = "") Then exit function else IIsObjectPath = IIsObjectPath & "/" & ObjectPath End If 'WScript.Echo "Checking : " & IISObjectPath Set IIsObject = GetObject(IIsObjectPath) If (Err.Number <> 0) Then if (Level = 1) then WScript.Echo "Error: " & Err.Description & " (" & Err.Number & ")" end if exit function End If Err.Clear For Each ChildObject In IIsObject If (Err.Number <> 0) Then ' WScript.Echo "Error = " & Err.Description ' Exit For end if if (ChildObject.Class = DirStyle) then ChildObjectName = Right(ChildObject.AdsPath, Len(ChildObject.AdsPath) - 6) ChildObjectName = Right(ChildObjectName, Len(ChildObjectName) - InStr(ChildObjectName, "/") ) if (len(ChildObjectName) < 60) then ChildObjectName = ChildObjectName & space(60-len(childObjectName)) end if WScript.Echo ChildObjectName & " - " & ChildObject.AuthAnonymous EnumVirtualDirectories Level+1, MachineName, ChildObjectName, DirStyle end if next End Function Sub DisplayHelpMessage() WScript.Echo WScript.Echo "Usage:" WScript.Echo " EnumAnonymousAccessDisabled.VBS WebSiteNumber" WScript.Echo WScript.Echo "WebSiteNumber is the number of the web site, you have two methods to determine this:" WScript.Echo WScript.Echo "#1 = Run FINDWEB.VBS" WScript.Echo "#2 = Right click the web site, select properties, on the web site tab" WScript.Echo " under logging click the Properties button, part of the log file" WScript.Echo " name will contain the web site #" WScript.Echo WScript.Echo " example log filename: W3SVC1\exyymmdd.log - the web site is 1" WScript.Echo " W3SVC45\exyymmdd.log - the web site is 45" end sub Const GENERAL_FAILURE = 2 ' Get the Arguments object Set ArgObj = WScript.Arguments ' Test to make sure there is at least one command line arg - the command If ArgObj.Count < 1 Then DisplayHelpMessage WScript.Quit (GENERAL_FAILURE) End If Servername = "LocalHost" WebSiteID = ArgObj(0) WebSite = "W3SVC/" & WebSiteID & "/Root" Level = 1 WScript.Echo "Allow Anonymous Access" WScript.Echo "" WScript.Echo "Virtual Directories for " & WebSite EnumVirtualDirectories Level, ServerName, WebSite, "IIsWebVirtualDir" WScript.Echo "" WScript.Echo "Physical Directories for " & WebSite EnumVirtualDirectories Level, ServerName, WebSite, "IIsWebDirectory"