ir As String
Dim websvc, vRoot, vDir
sComputer = "localhost"
''Get Default Web Site Object
Set websvc = GetObject("IIS://" & sComputer & "/W3svc/1")
''Get root of Default Web Site
Set vRoot = websvc.GetObject("IIsWebVirtualDir", "Root")
Dim itm As ListItem
Dim buf As String, errInfo As String, tryVirt
For Each itm In ListView1.ListItems
Err.Clear
On Error Resume Next
Call vRoot.Delete("IISWebVirtualDir", itm.SubItems(1))
If Err.Number <> 0 Then
errInfo = errInfo & vbCrLf & itm.SubItems(1)
End If
Err.Clear
Next
3。其他诸如建立站点,删除站点可以类似做到,具体可以通过在 msdn 中
搜索 IISWebVirtualDir 看到