IIS API - Create virtual directories?

前端 未结 4 2168
离开以前
离开以前 2020-12-09 00:55

Just looking for the relevant documentation. An example is not necessary, but would be appreciated.

We have a situation where we are having to create 100s of virt

4条回答
  •  一生所求
    2020-12-09 01:15

    Evidently you can also do this via PowerShell scripting:

    $objIIS = new-object System.DirectoryServices.DirectoryEntry("IIS://localhost/W3SVC/1/Root")
    $children = $objIIS.psbase.children
    $vDir = $children.add("NewFolder",$objIIS.psbase.SchemaClassName)
    $vDir.psbase.CommitChanges()
    $vDir.Path = "C:\Documents and Settings\blah\Desktop\new"
    $vDir.defaultdoc = "Default.htm"
    $vDir.psbase.CommitChanges()
    

    Here is the documentation: MSDN - Using IIS Programmatic Administration

提交回复
热议问题