利用ADSI给IIS创建虚拟目录(VBS)。
IIS 5.1(Winxp默认那个)和以前版本不支持WMI,所以用ADSI来做。后两个run是用来设置服务器扩展用的。
output "Creating Web Application for IIS://LocalHost/W3SVC/1/ROOT/" & AppName
Set DirObj = GetObject("IIS://LocalHost/W3SVC/1/ROOT")
on error resume next
DirObj.delete "IIsWebVirtualDir", AppName
on error goto 0
set mywd = DirObj.Create ("IIsWebVirtualDir", AppName)
mywd.setinfo
mywd.AppCreate true
mywd.setinfo
run """c:\program files\common files\microsoft shared\web server extensions\40\bin\fpsrvadm.exe"" -o install -p 80 -w /" & AppName
run """c:\program files\common files\microsoft shared\web server extensions\40\bin\fpsrvadm.exe"" -o check -p 80 -w /" & AppName
Set DirObj = GetObject("IIS://LocalHost/W3SVC/1/ROOT")
on error resume next
DirObj.delete "IIsWebVirtualDir", AppName
on error goto 0
set mywd = DirObj.Create ("IIsWebVirtualDir", AppName)
mywd.setinfo
mywd.AppCreate true
mywd.setinfo
run """c:\program files\common files\microsoft shared\web server extensions\40\bin\fpsrvadm.exe"" -o install -p 80 -w /" & AppName
run """c:\program files\common files\microsoft shared\web server extensions\40\bin\fpsrvadm.exe"" -o check -p 80 -w /" & AppName