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

Re: displaying physical and virtual paths by Kristofer

Kristofer
Sat May 28 05:20:59 CDT 2005

Hi Marcus,

This example script available at iisfaq.com displays all virtual
directories and theirs path:

http://www.iisfaq.com/Default.aspx?tabid=3156

What i cannot understand in your post is why you cannot print out the
paths if you already have a list of what you want to print. That seems to
be a scripting question, since you already have gotten everything you need
from IIS (metabase).

If this is a question about how you print the list to the standard output,
you may want to try a scripting newsgroup:

microsoft.public.scripting.*


--
Regards,
Kristofer Gafvert (IIS MVP)
www.gafvert.info - My Articles and help
www.ilopia.com


marcus.foody@gmail.com wrote:

> 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