Method of Creating FTP Virtual Directory with iisftpdr.vbs


Applications: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1

Using the command line script iisftpdr.vbs (stored in systemroot\System32\\\\\\) you can create a new FTP virtual directory on a local or remote computer running Windows Server 2003 family members with IIS 6.0. This command does not create or destroy content, but simply sets up the virtual directory structure and IIS configuration file.

If there is no iisftpdr.vbs file, you can download it from developpaer: //

When creating a new FTP virtual directory using iisftpdr. vbs, only the basic attributes required to create a site and identify its content are specified. The default properties used by Iisftpdr. VBS are the same as those used by IIS Manager when creating a new virtual directory, and it follows the same inheritance property rules. To configure more advanced properties of the directory, use IIS Manager.

Important matters

Only members of the Administrators group on the local computer can run scripts and executable files. As a security best practice, log on to your computer using an account that does not belong to the Administrators group, and then use the runas command to run scripts and executable files as administrators. At the command prompt, type runas/profile/User: MyComputerAdministrator cmd, open a command window with administrator privileges, and then type cscript.exeScriptName (including the full path of the script and any parameters).
This topic includes the following information:

Grammar: the order in which commands must be typed and any parameters and options that follow them.
Parameter: Give the value of the variable in the command.
Sample: Sample code and description of the results.

iisftpdr /create FTPSite[VirtualPath] Name PhysicalPath [ /s Computer [ /u [Domain\]User /p Password]]


Necessary. Specify the descriptive name of the FTP site or configure the database path.


If necessary, specify a path to the virtual directory within the site. This parameter is necessary when the virtual directory is not in the root directory of the website.


Necessary. Specify a name for the virtual directory. Virtual directory names need not be unique. However, when FTP sites include virtual directories and physical directories with the same name, physical directories will not be seen on the Internet.


Specifies the physical directory that hosts the contents of the virtual directory. A path must be specified on the local computer, such as C: Project FTP. If the specified directory does not exist, iisftpdr creates it.

/s Computer

Run the script on the specified remote computer. Type the computer name or IP address without backslash. The default is the local computer.

/u [Domain\]User

Run the script with the privileges of the specified user account. The account must be a member of the Administrators group on the remote computer. By default, the script runs with the privileges of the current user of the local computer.

/p Password

Specifies the password for the user account specified in the / u parameter.

FTPSite (or FTPSite/VirtualPath), Name, and Hysical Path parameters must appear in the specified order on the command line. Otherwise, iisftpdr. VBS cannot interpret the information correctly.

Example 1:
The following example creates the virtual directory “Scripts” in the root directory of the “Test Downloads” FTP site on the local computer. It associates this directory with the content currently stored in the C: Libraries Scripts directory.

Copy codeThe code is as follows:
iisftpdr /create “Test Downloads” Scripts C:\Libraries\Scripts

In response, iisftpdr displays the following success messages and the basic attributes of the new virtual directory. In this example, the “virtual path” reflects the virtual directory structure, the “root” represents the physical directory where the content resides, and the “configuration database path” represents the configuration database entry specified by IIS (similar to the registry entry in the system registry).

Connecting to server …Done.
Virtual Path = Test Downloads/Scripts
ROOT = C:\Libraries\Scripts
Metabase Path = MSFTPSVC/577648624/ROOT/Scripts

Example 2:
The following example adds the virtual directory “Updates” to the FTP site of the remote server. This command creates a new virtual directory at the “Finance” FTP site as a subdirectory of the existing virtual directory “Documents”.

The first parameter in the command Finance Documents identifies the FTP site and virtual path. The second parameter, Updates, specifies the name of the virtual directory, and the third parameter, specifies the physical directory on the server that stores the contents of the virtual directory.

The command identifies the server computer with the / S parameter and runs iisftpdr. VBS with the / u and / P parameters with the user’s administrator account privileges.

Copy codeThe code is as follows:
iisftpdr /create Finance/Documents Updates C:\inetpub\ftproot\documents\updates /s SVR01 /u Admin01 /p [email protected]#rD2

In response, iisftpdr displays the basic attributes of the new FTP site. In this example, before issuing this command, the “Finance” FTP site and its “Documents” subdirectory existed on the SVR01 IIS server. If the FTP site or subdirectory does not exist, the command will fail.

Connecting to server …Done.
Virtual Path = Finance/Documents/Updates
ROOT = C:\inetpub\ftproot\documents\updates
Metabase Path = MSFTPSVC/2109607139/ROOT/Documents/Updates

Of course, we can achieve batch operation by combining bat. If combined with timing tasks, we can complete tasks on time, which is convenient and fast.