I've managed to get a list of the physical and virtual directories from
w/in IIS 6. What I need is a way to also print out the paths of these
physical and virtual directories.
For example:
ROOT/IISHelp <IISWebVirtualDirectory> c:\windows\help\iishelp
ROOT/archive <IISWebDirectory> c:\inetpub\wwwroot\archive\
Here is the code:
---------
Call DisplayTree(GetObject("IIS://LOCALHOST/W3SVC/1/ROOT"), 0, "")
Sub DisplayTree(obj, depth, path)
If ( "IIsWebServer" = obj.Class ) Then
WScript.Echo Space(depth * 3) & path & obj.Name & " - " &
obj.ServerComment & " (" & obj.Class & ")"
ElseIf ( "IIsWebVirtualDir" = obj.Class OR "IIsWebDirectory" =
obj.Class ) Then
WScript.Echo Space(depth * 3) & path & obj.Name & " (" &
obj.Class & ")"
End If
Select Case obj.Class
Case "IIsWebService", "IIsWebServer", "IIsWebVirtualDir",
"IIsWebDirectory"
Dim currObj
For Each currObj in obj
Call DisplayTree(currObj, depth + 1, path + obj.Name + "/")
Next
End Select
End Sub