IIS API - Create virtual directories?

前端 未结 4 2203
离开以前
离开以前 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:30

    It is easier to do it with vbscript too..

    ' This code creates a virtual directory in the default Web Site
    ' ---------------------------------------------------------------
    ' From the book "Windows Server Cookbook" by Robbie Allen
    ' ISBN: 0-596-00633-0
    ' ---------------------------------------------------------------
    
    ' ------ SCRIPT CONFIGURATION ------
    strComputer = "rallen-w2k3"
    strVdirName = ""  'e.g. employees
    strVdirPath = ""      'e.g. D:\resumes
    ' ------ END CONFIGURATION ---------
    set objIIS = GetObject("IIS://" & strComputer & "/W3SVC/1")
    set objWebSite = objIIS.GetObject("IISWebVirtualDir","Root")
    set objVdir = objWebSite.Create("IISWebVirtualDir",strVdirName)
    objVdir.AccessRead = True
    objVdir.Path = strVdirPath
    objVdir.SetInfo
    WScript.Echo "Successfully created virtual directory: " & objVdir.Name
    

提交回复
热议问题