AdminScripts script is located in the \Inetpub\Adminscripts directory, this article describes how to use these scripts to create a virtual directory and to set parameters for that virtual directory.
There are a lot of scripts in the AdminScripts directory, and only two of them are used here, Adsutil.vbs and Chaccess.vbs:
Adsutil.vbs-can be used to create and configure virtual directories (in fact, Adsutil.vbs features cover all other scripts)
Chaccess.vbs-Set permissions on virtual directories
The following is the content of the batch script Makevd.bat, starting with a description of how the batch script is invoked:
Makevd.bat "virtual directory Name" "Virtual directory Path"
Example: Makevd.bat "Myvirtualdirectory" "D:\myweb\test"
The next step is Makevd.bat's content:
The following is a reference fragment:
@echo off
Echo ######################################################
Echo ######### ########
Echo ######### is creating a virtual directory ... ########
echo ######### Please do not close this window! ########
Echo ######### ########
Echo ######################################################
REM Create a virtual directory
cscript scripts\adsutil.vbs//nologo//t:300 create w3svc/1/root/%1 "IIsWebVirtualDir"
REM set the properties of a virtual directory
REM creates an in-process application (. NET has no InProc and Outproc, but old scripts can still be used.
cscript scripts\adsutil.vbs//nologo//t:60 Appcreateinproc w3svc/1/root/%1
REM set the root directory of the application
cscript scripts\adsutil.vbs//nologo//t:60 set w3svc/1/root/%1/approot/lm/w3svc/1/root/%1
REM set the display name of the application
cscript scripts\adsutil.vbs//nologo//t:60 set w3svc/1/root/%1/appfriendlyname%1
REM sets the isolation level of the application (in. NET without setting)
cscript scripts\adsutil.vbs//nologo//t:60 set w3svc/1/root/%1/appisolated 2
REM set the path of the virtual directory
cscript scripts\adsutil.vbs//nologo//t:60 set W3svc/1/root/%1/path%2
REM sets the Execute permissions on the virtual directory, 513 is a pure scripting way
cscript scripts\adsutil.vbs//nologo//t:60 set w3svc/1/root/%1/accessflags 513
REM set AuthFlags value, 5 indicates allow anonymous access and integrated Windows authentication
cscript scripts\adsutil.vbs//nologo//t:60 set w3svc/1/root/%1/authflags 5
REM set the DirBrowseFlags value, DirBrowseFlags is the control of directory browsing switch parameters, more complex, just fill in the line
cscript scripts\adsutil.vbs//nologo//t:60 set W3svc/1/root/%1/dirbrowseflags 1073741886
REM Set Default Document
cscript scripts\adsutil.vbs//nologo//t:60 set W3svc/1/root/%1/defaultdoc "default.aspx"
REM Set directory permissions (readable, non-writable, browsable script resource, not viewable directory)
cscript scripts\chaccess.vbs//nologo//t:60-a w3svc/1/root/%1 +read-write
Nologo and//t:60 are cscript running parameters, setting the running display mode and maximum running time, respectively.