Delen via


Creating FTP Virtual Directories Using Iisftpdr.vbs

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1

You can use the command-line script iisftpdr.vbs, which is stored in systemroot\System32\, to create new FTP virtual directories on local or remote computers running a member of the Windows Server 2003 family with IIS 6.0. This command does not create or destroy content, but simply sets up the virtual directory structure and IIS configuration files.

When you use iisftpdr.vbs to create a new FTP virtual directory, you specify only the basic properties needed to create the site and identify its contents. Iisftpdr.vbs uses the same default properties that IIS Manager uses when establishing new virtual directories, and it adheres to the same rules for inheriting properties. To configure the more advanced properties of the directory, use IIS Manager.

Important

You must be a member of the Administrators group on the local computer to run scripts and executables. As a security best practice, log on to your computer by using an account that is not in the Administrators group, and then use the runas command to run your script or executable as an administrator. At a command prompt, type runas /profile /User:MyComputer</STRONG>Administrator cmd to open a command window with administrator rights and then type cscript.exe ScriptName (include the script's full path and any parameters).

This topic includes the following information:

  • Syntax: The order in which you type a command and any arguments and options that follow it.

  • Parameters: The values that are given to variables in the command.

  • Examples: Sample code and an explanation of the results.

Syntax

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

Parameters

FTPSite

Required. Specifies the descriptive name or the metabase path of the FTP site.

VirtualPath

Specifies a path, if necessary, to the virtual directory within the Web site. This parameter is required when the virtual directory is not located at the root of the Web site.

Name

Required. Specifies a name for the virtual directory. Virtual directory names do not have to be unique. However, when an FTP site includes a virtual directory and a physical directory with the same name, the physical directory will not be visible on the Internet.

PhysicalPath

Specifies a physical directory where the content for the virtual directory resides. You must specify a path on the local computer, such as C:\Project\FTP. If the specified directory does not exist, iisftpdr will create it.

/sComputer

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

/u*[Domain\]User*

Runs the script with the permissions of the specified user account. This 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.

/pPassword

Specifies the password of the user account that is specified in the /u parameter.

Note

The FTPSite (or FTPSite/VirtualPath), Name, and PhysicalPath parameters must always appear in the specified order on the command line. Otherwise, iisftpdr.vbs does not interpret the information correctly.

Examples

Example 1:

The following example creates the virtual directory "Scripts" at the root of the "Test Downloads" FTP site on the local computer. It associates the directory with content that is currently stored in the C:\Libraries\Scripts directory.

iisftpdr /create "Test Downloads" Scripts C:\Libraries\Scripts

In response, iisftpdr displays the following success message along with 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 key assigned by IIS and is analogous to a 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 a remote server. The command creates the new virtual directory on 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 content of the virtual directory.

The command uses the /s parameter to identify the server computer, as well as the /u and /p parameters to run iisftpdr.vbs with the permissions of the user's administrator account.

iisftpdr /create Finance/Documents Updates C:\inetpub\ftproot\documents\updates /s SVR01 /u Admin01 /p p@SSw#rD2

In response, iisftpdr displays the basic properties of the new FTP site. In this example, the "Finance" FTP site and its "Documents" subdirectory existed on the SVR01 IIS server before the command was issued. If the FTP site or the subdirectory did not exist, the command would have failed.

Connecting to server ...Done.

Virtual Path = Finance/Documents/Updates

ROOT = C:\inetpub\ftproot\documents\updates

Metabase Path = MSFTPSVC/2109607139/ROOT/Documents/Updates