Applied to: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1
You can use command-line scripting Iisftpdr.vbs (stored in systemroot\system32\) to create a new FTP virtual directory on a local or remote computer running a member of the Windows Server 2003 family with IIS 6.0. This command does not create or destroy content, but simply sets the virtual directory structure and IIS configuration files.
If no iisftpdr.vbs files can be downloaded to the cloud Habitat community: http://www.jb51.net/jiaoben/193101.html
When you use Iisftpdr.vbs to create a new FTP virtual directory, you specify only the basic attributes that are required to create the site and identify its content. The default properties used by Iisftpdr.vbs are the same as the properties that IIS Manager uses when establishing a new virtual directory, and it follows the same inheritance property rules. To configure more advanced properties for the directory, use IIS Manager.
Important matters
Only members of the Administrators group on the local computer can run scripts and executables. As a security best practice, log on to the computer using an account that is not part of the Administrators group, and then use the runas command to run scripts and executables as an administrator. At the command prompt, type runas/profile/user:mycomputer\administrator cmd, open a command window with administrator privileges, and then type Cscript.exescriptname (including the full path and any parameters of the script).
This topic includes the following information:
• Syntax: The order in which you type the command and any parameters and options that follow it.
• Parameter: Gives the value of the variable in the command.
• Example: Sample code and a description of the result.
Grammar
Iisftpdr/create Ftpsite[virtualpath] Name physicalpath [/s Computer [/u [domain\]user/p Password]]
Parameters
Ftpsite
Required. Specifies the descriptive name or metabase path for the FTP site.
VirtualPath
If necessary, specify a path to the virtual directory within the Web site. This parameter is required when the virtual directory is not in the root directory of the Web site.
Name
Required. Specify a name for the virtual directory. Virtual directory names do not have to remain unique. However, when an FTP site includes a virtual directory and a physical directory with the same name, the physical directory is not visible on the Internet.
PhysicalPath
Specifies the physical directory where the contents of the virtual directory reside. You must specify a path on the local computer, such as C:\Project\FTP. If the specified directory does not exist, IIsFtpDr creates the directory.
/s Computer
Runs the script on the specified remote computer. Type the name or IP address of the computer without the backslash. The default is the local computer.
/u [domain\]user
Runs the script with the permissions 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 permissions of the current user of the local computer.
/P Password
Specifies the password for the user account specified in the/u parameter.
Note
the Ftpsite (or Ftpsite/virtualpath), Name, and PhysicalPath parameters must appear in the specified order on the command line. Otherwise, iisftpdr.vbs cannot interpret the information correctly.
Sample
Example 1:
The following example creates a virtual directory "Scripts" in the root directory of the "Test Downloads" FTP site on the local computer. It associates the directory with what is currently stored in the C:\Libraries\Scripts directory.
Copy Code code as follows:
Iisftpdr/create "Test Downloads" Scripts C:\Libraries\Scripts
In response, IISFTPDR displays the following success messages and the basic properties of the new virtual directory. In this example, "virtual path" reflects the virtual directory structure, "root" represents the physical directory where the content resides, and "Metabase Path" represents the metabase entry specified by IIS, which is similar to the registry key 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 as a subdirectory of the existing virtual directory "Documents" at the "Finance" FTP site.
The first parameter in the command finance\documents identifies the FTP site and the 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.
This command uses the/s parameter to identify the server computer and uses the/U and/P parameters to run iisftpdr.vbs with the user's administrator account permissions.
Copy Code code as follows:
Iisftpdr/create finance/documents Updates c:\inetpub\ftproot\documents\updates/s svr01/u admin01/p
In response, IIsFtpDr displays the basic properties of the new FTP site. In this example, before this command is issued, the "Finance" FTP site and its "Documents" subdirectory exist on the SVR01 IIS server. If an FTP site or subdirectory does not exist, the command fails.
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 use the combination of bat to achieve bulk operation, if the combination of scheduled tasks can be completed on time task, convenient and quick.