My InstallShield installer needs to install a file in the IIS Default Web Site's Home Directory, and set it to the default web page.
Unfortunately, in our environments, I can't assume that the home directory is C:\Inetpub\wwwroot, but I need to find out what it is.
Any idea on how I can do this with a script? We need to support XP, 2003 and 2008.
Found it - it's dead simple:
Dim objIIsWebService
Set objIIsWebService = GetObject("IIS://localhost/W3SVC/1/ROOT")
wscript.echo objIIsWebService.Path
I knew there had to be an easy way!
You can use a script to enumerate the IIS Web Sites and query them for information.
Something like
SET objWebService = GetObject( "IIS://" & strServer & "/W3SVC" )
FOR EACH objWebServer IN objWebService
objWebService.SomeProperty
...
But I think this belongs on Server Fault.