pduncan
pduncan

Reputation: 1460

Need to find Default Web Site's Home Directory in IIS

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.

Upvotes: 2

Views: 3906

Answers (2)

pduncan
pduncan

Reputation: 1460

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!

Upvotes: 2

bzlm
bzlm

Reputation: 9727

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.

Upvotes: 0

Related Questions