这要用到微软的ADSI技术
你可以到这里看看,资料挺全的
http://www.activeedu.net/school/website/View.asp?articleID=2281
给你个我写的测试的冬冬
Private Sub Command2_Click()
'我们需要确认IIS应用程序是否存在。使用IIS Admin对象,
'我们检查是否应用程序早已存在并且把相应的警告传递给用户。' Does this IIS application already exist in the metabase?
Dim ADSIPath As String
On Error Resume Next
'我们需要确认IIS应用程序是否存在。使用IIS Admin对象,
'我们检查是否应用程序早已存在并且把相应的警告传递给用户?
Set objIIS = GetObject("IIS://localhost/W3SVC/1/Root/" & "xxxxx")If Err.Number = 0 ThenMsgBox "xxxxx已经存在", , "设置虚拟目录"
ElseADSIPath = "IIS://localhost/W3SVC/1/ROOT"
'MsgBox ADSIPath
Set defaultSite = GetObject(ADSIPath)
Set vDir = defaultSite.Create("IISWebVirtualDir", "xxxxx")
vDir.Path = "C:\myweb"'设置虚拟目录属性
vDir.AccessRead = True
vDir.AccessScript = True
vDir.DefaultDoc = "index.asp"
vDir.SetInfo
MsgBox "虚拟目录设置成功!", , "设置虚拟目录"
End If
Set objIIS = Nothing
End Sub