Finding IIS home directory with getObject

Finding IIS home directory with getObject

am 01.06.2007 22:28:41 von Steve Ricketts

I would like to enumerate the web sites on a server and find the physical
directory for each. I can enumerate them with the following code:

set objW3 = getObject("IIS://localhost/W3SVC")
for each webSite in objW3
webSite.ServerComment 'Web site name
next

But I can't figure out what property to use to find the file path.
webSite.Path creates an error.

Can anyone point me in the right direction? And if this is not the proper
forum to ask the question, you could direct me to the proper forum.

Many thanks,

Steve

Re: Finding IIS home directory with getObject

am 02.06.2007 06:48:41 von Ken Schaefer

From memory

..ServerComment is stored as an attribute of the website. However .Path is an
attribute of the "Root" node located underneath the website. So you may need
to get a handle to the root node first.

Cheers
Ken


"Steve Ricketts" wrote in message
news:%23GNE0tIpHHA.3368@TK2MSFTNGP02.phx.gbl...
>I would like to enumerate the web sites on a server and find the physical
>directory for each. I can enumerate them with the following code:
>
> set objW3 = getObject("IIS://localhost/W3SVC")
> for each webSite in objW3
> webSite.ServerComment 'Web site name
> next
>
> But I can't figure out what property to use to find the file path.
> webSite.Path creates an error.
>
> Can anyone point me in the right direction? And if this is not the proper
> forum to ask the question, you could direct me to the proper forum.
>
> Many thanks,
>
> Steve
>

Re: Finding IIS home directory with getObject

am 02.06.2007 13:07:33 von Steve Ricketts

I guess that's part of my problem. I know how to get the root node of one
web using something like:

set objWebsite = getObject("IIS://localhost/W3SVC/1/Root")
sDirectory = objWebsite.Path

But I don't know how to get the other sites. I thought incrementing the 1
would make sense but that didn't work. So, if I have the Website object.
how do I get it's root node from that object?

Thanks for the help, very much appreciated.

Steve


"Ken Schaefer" wrote in message
news:uEumMFNpHHA.1240@TK2MSFTNGP06.phx.gbl...
> From memory
>
> .ServerComment is stored as an attribute of the website. However .Path is
> an attribute of the "Root" node located underneath the website. So you may
> need to get a handle to the root node first.
>
> Cheers
> Ken
>
>
> "Steve Ricketts" wrote in message
> news:%23GNE0tIpHHA.3368@TK2MSFTNGP02.phx.gbl...
>>I would like to enumerate the web sites on a server and find the physical
>>directory for each. I can enumerate them with the following code:
>>
>> set objW3 = getObject("IIS://localhost/W3SVC")
>> for each webSite in objW3
>> webSite.ServerComment 'Web site name
>> next
>>
>> But I can't figure out what property to use to find the file path.
>> webSite.Path creates an error.
>>
>> Can anyone point me in the right direction? And if this is not the
>> proper forum to ask the question, you could direct me to the proper
>> forum.
>>
>> Many thanks,
>>
>> Steve
>>
>

Answer: Finding IIS home directory with getObject

am 02.06.2007 18:05:06 von Steve Ricketts

Ok, Ken's comments were enough for me to figure it out. Here's how you
enumerate the web sites and then retreive the site's path.

set objW3SVC = getObject("IIS://localhost/W3SVC")
for each IISwebSite in objW3SVC
debug.print IISwebSite.ServerComment 'Web site name
set objWeb = getObject(IISwebsite.adsPath & "/Root")
rootPath = objWeb.Path
next

Thanks for the pointers Ken!

Steve

"Steve Ricketts" wrote in message
news:%23GNE0tIpHHA.3368@TK2MSFTNGP02.phx.gbl...
>I would like to enumerate the web sites on a server and find the physical
>directory for each. I can enumerate them with the following code:
>
> set objW3 = getObject("IIS://localhost/W3SVC")
> for each webSite in objW3
> webSite.ServerComment 'Web site name
> next
>
> But I can't figure out what property to use to find the file path.
> webSite.Path creates an error.
>
> Can anyone point me in the right direction? And if this is not the proper
> forum to ask the question, you could direct me to the proper forum.
>
> Many thanks,
>
> Steve
>