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

自古美人都是妖i 提交于 2019-12-11 03:04:41

问题


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.


回答1:


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!




回答2:


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.



来源:https://stackoverflow.com/questions/1835929/need-to-find-default-web-sites-home-directory-in-iis

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!