The virtdir.exe utility is designed to manage virtual directories on domains. The utility allows the following:

  • creating, configuring, and removing a virtual directory
  • setting read and write access permissions for a virtual directory
  • creating a virtual directory as an IIS application and managing the application settings
  • managing virtual directory security
  • specifying which version of ASP.NET and PHP to use for a virtual directory
  • configuring ASP (for example, enabling script debugging)

Note: The functionality of virtdir.exe utility is not equal to functionality of Web Directories in Plesk GUI.

Location

%plesk_cli%

Usage

virtdir.exe <command> [<name>] [
<option 1> <param 1>[,<param 2>,...,<param N>]
[<option 2> <param 1>[,<param 2>,...,<param N>]]
... [<option n> <param 1>[,<param 2>,...,<param N>]]
]

Example

The following command creates the /vd1 virtual directory on example.com as follows: it creates the physical directory in the root directory of the virtual host, maps it to the new virtual directory; allows write access to the contents of the virtual directory (including the source code), disallows read access to these resources, allows viewing the contents of the virtual directory in a browser; disables logging visits on the virtual directory; makes the virtual directory function as a web application (from the standpoint of IIS); disallows running any scripts or executables; sets no default page to display in the browser if no particular page is specified by the user; allows public access to the virtual directory; turns off SSL/TLS support for this directory.

plesk bin virtdir.exe -c /vd1 -vhost example.com -create_phys true -access_source true -access_read false -access_write true -dir_browsing true -log_visits false -create_app false -execute_perm none -default_doc false -access_anonymous true -require_ssl false

Commands

Command Parameter Description Example
--create or -c <name> Creates a virtual directory with a specified name relative to the domain root directory.

To create the /vd1 virtual directory on example.com:

plesk bin virtdir.exe --create /vd1 -vhost example.com

or

plesk bin virtdir.exe -c /vd1 -vhost example.com

--update or -u <name> Updates parameters of a virtual directory.

To rename the virtual directory from /vd1 to /new_vd1 on example.com:

plesk bin virtdir.exe --update /vd1 -vhost example.com -name news

or

plesk bin virtdir.exe -u /vd1 -vhost example.com -name news

--remove or -r <name> Removes a virtual directory.

To remove the virtual directory /vd1 from example.com:

plesk bin virtdir.exe --remove /vd1 -vhost example.com

or

plesk bin virtdir.exe -r /vd1 -vhost example.com

--info or -i <name> Retrieves information about a virtual directory.

To retrieve the info about the virtual directory /vd1 referring to example.com:

plesk bin virtdir.exe --info /vd1 -vhost example.com

or

plesk bin virtdir.exe -i /vd1 -vhost example.com

--help or -h   Displays help on the use of the utility.

To see the help info on the use of this utility:

plesk bin virtdir.exe --help

or

plesk bin virtdir.exe -h

Options

Option Parameter Description Example
-vhost <host_name>

Specifies a name of a virtual host that owns a virtual directory.

Is required in all commands where a virtual directory is specified.

To enable SSL/TLS for the virtual directory /vd1 on example.com:

plesk bin virtdir.exe --update /vd1 -vhost example.com -require_ssl true

-create_phys true|false

Allows/Prohibits automatically creating physical directory of the same name for a new virtual directory.

Is true by default.

Is available with --create only.

To prohibit creating the physical directory of the same name for virtual directory /vd1 on example.com:

plesk bin virtdir.exe --create /vd1 -vhost example.com -create_phys false

To allow creating the virtual directory /vd2 within /vd1 and a physical directory of the same name on example.com:

plesk bin virtdir.exe --create /vd1/vd2 -vhost example.com -create_phys true

-name <relative_name>

Specifies a new name when it is necessary to rename a virtual directory.

Is available with --update only.

To rename the /vd1/vd2 virtual directory to /vd1/news on example.com:

plesk bin virtdir.exe --update /vd1/vd2 -vhost example.com -name news

-path <relative_path>

Specifies a path of a physical directory mapped by a virtual directory.

The path is specified relative to the root directory of the domain that owns this physical directory.

Is / by default.

To redirect the /vd1/vd2 virtual directory from /vd1/vd2 to / on example.com:

plesk bin virtdir.exe --update /vd1/vd2 -vhost example.com -path /

-access_source true|false

Enables/Disables accessing source code of ASP applications (residing within a specified virtual directory and its non-virtual subfolders) with read/write permissions (if set).

Is false by default.

To enable reading scripts of ASP applications of the /vd1 virtual directory on example.com:

plesk bin virtdir.exe --update /vd1 -vhost example.com -access_read true -access_source true

-access_read true|false

Enables/Disables read access permissions to files located within a specified virtual directory.

Is true by default.

To disable read access to files of the virtual directory /vd1 on example.com:

plesk bin virtdir.exe --update /vd1 -vhost example.com -access_read false

-access_write true|false

Enables/Disables write access permissions on files located within a specified virtual directory.

Is false by default.

To enable write access permissions on files of the /vd1 virtual directory on example.com:

plesk bin virtdir.exe --update /vd1 -vhost example.com -access_write true

-dir_browsing true|false

Enables/Disables user to see files and nested directories of a specified virtual directory in a browser.

Is false by default.

To enable browsing the structure of the /vd1 virtual directory on example.com:

plesk bin virtdir.exe --update /vd1 -vhost example.com -dir_browsing true

-log_visits true|false

Enables/Disables visits logging of a specified virtual directory in a browser.

Is true by default.

To turn of visits logging for the website (virtual directory /vd1) on example.com:

plesk bin virtdir.exe --update /vd1 -vhost example.com -log_visits false

-create_app true|false

Enables/Disables creating a virtual directory as an IIS application.

Is true by default.

To disable creating the virtual directory /vd1 as an IIS application on example.com:

plesk bin virtdir.exe --update /vd1 -vhost example.com -create_app true -run_in_mta false

-execute_perm none | script | script_execute

Specifies the execution permission level for files located within a specified virtual directory.

If set to none, allows the display of static files (HTML, images, etc.) only.

If set to script, allows the execution of scripts only.

If set to script_execute, allows the execution of all files, including scripts and executables.

To restrict the running of executables, but allow all other files of the virtual directory /vd1 on the domain example.com to execute:

plesk bin virtdir.exe --update /vd1 -vhost example.com -execute_perm script

-parent_paths true|false

Enables/Disables active scripts of a specified virtual directory to use relative paths to access its parent directories (using the .. syntax).

If set to true, it is recommended that the -execute_perm option is set to none.

Is available with the -create_app option set to true only.

To enable access to parent directories of the virtual directory /vd1 on example.com by a relative path:

plesk bin virtdir.exe --update /vd1 -vhost example.com -execute_perm none -parent_paths true

-run_in_mta true|false

Enables/Disables running the IIS application (located in a specified virtual directory) in the multithreaded apartment (MTA).

Is available with the -create_app option set to true only.

To set the IIS application stored in the virtual directory /vd1 on example.com to be executed in a dedicated process (STA):

plesk bin virtdir.exe --update /vd1 -vhost example.com -create_app true -run_in_mta false

-default_doc true|false

Enables/Disables displaying a default page when a user enters a specified virtual directory with no particular file name specified.

If it is set to false, no default page is used and two cases are possible:

  • if the -dir_browsing option is true, a list of all files and nested directories in FTP style is displayed;
  • if -dir_browsing option is false, the Access forbidden message is displayed.

To disable displaying a default file and listing the contents for the virtual directory /vd1 on example.com:

plesk bin virtdir.exe --update /vd1 -vhost example.com -dir_browsing true -default_doc false

-default_doc_order <doc 1>,<doc 2>, ,<doc N>

Specifies the prioritized list of default pages for IIS to search within the virtual directory.

The first match is displayed. If no match is found, displayed is the list of all files and nested folders in FTP style.

The option is available with the -default_doc option enabled.

To specify the default pages list for the virtual directory /vd1 on example.com:

plesk bin virtdir.exe --update /vd1 -vhost example.com -default_doc true -default_doc_order index.html,page1.html

-access_anonymous true|false

Enables/Disables public access to the virtual directory.

If true, the user can access the directory without authentication.

To restrict access to the virtual directory /vd1 on example.com:

plesk bin virtdir.exe --update /vd1 -vhost example.com -access_anonymous false

-access_windows true|false Enables/Disables Windows authentication for users accessing the virtual directory.

To restrict access to the virtual directory /vd1 on example.com:

plesk bin virtdir.exe --update /vd1 -vhost example.com -access_windows false

-require_ssl true|false

Enables/Disables SSL/TLS access to the virtual directory.

If true, the virtual directory can be accessed via SSL/TLS only.

To enables SSL/TLS access to the virtual directory /vd1 on example.com:

plesk bin virtdir.exe --update /vd1 -vhost example.com -require_ssl true

-php_version 4|5|5.3|5.4|5.5|5.6 Specifies the PHP version.

To select PHP 5.4 support for the virtual directory /vd1 on example.com:

plesk bin virtdir.exe --update /vd1 -vhost example.com -php_version 5.4

-asp.net_version 1.1|2.0|4.0

Specifies the ASP.NET version.

Is available with -create_app option enabled and ASP.NET supported on the domain.

To select ASP.NET version 4.0 for web applications located in the virtual directory /vd1 on example.com:

plesk bin virtdir.exe --update /vd1 -vhost example.com -create_app true -asp.net_version 4.0

-mime-types "<type1> <extension1>; ... <typeN> <extensionN>" Sets MIME types for the specified directory. For example: ‘text/plain .txt image/jpeg .jpeg’.

To set custom MIME types and access by IP addresses for the website (virtual directory /vd1) on example.com:

plesk bin virtdir.exe --update /vd1 -vhost example.com --mime-types "image/jpeg .jpg" -ip_deny 192.168.1.0/16 -ip_allow 192.168.1.11

-ip_deny "<IP address 1> <IP address 2> ... <IP address N>" Sets a list of IP addresses that will be denied access to the specified website. Use spaces to separate IP addresses. For example: ‘10.1.0.0/16 192.168.1.110’.  
-ip_allow "<IP address 1> <IP address 2> ... <IP address N>" Sets a list of IP addresses that will be allowed to access the specified website. Use spaces to separate IP addresses. For example: ‘192.168.0.0/16 10.1.1.21’.  
-aspBufferingLimit <KB> Limits the size of ASP buffer assigned to a specified virtual directory.

To restrict the maximum size of the ASP buffer available for virtual directory /vd1 on example.com to 1 MB:

plesk bin virtdir.exe --update /vd1 -vhost example.com -aspBufferingLimit 1024

-aspMaxRequestEntityAllowed <KB> Limits the size of ASP request entity body.

To restrict the maximum size of ASP request entity body available for the virtual directory /vd1 on example.com to 3 MB:

plesk bin virtdir.exe --update /vd1 -vhost example.com -aspMaxRequestEntityAllowed 3072

-aspEnableServerDebug <true|false>

Enables/Disables ASP server-side script debugging.

If it is a root directory, default value is defined by IIS; else inherited by parent directory.

To enable server-side script debugging for the virtual directory /vd1 on example.com:

plesk bin virtdir.exe --update /vd1 -vhost example.com -aspEnableServerDebug true

-aspEnableClientDebug true|false

Enables/Disables ASP client-side script debugging.

If it is a root directory, default value is defined by IIS; else inherited by parent directory.

To enable client-side script debugging for the virtual directory /vd1 on example.com:

plesk bin virtdir.exe --update /vd1 -vhost example.com -aspEnableClientDebug true

-is_deny_by_concurrent_requests true|false

Sets dynamic denying of IP addresses based on the number of concurrent HTTP requests. Applies to the root virtual directory.

This restriction can be used together with the restriction based on the number of HTTP requests over a period of time.

Learn more at http://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-dynamic-ip-address-restrictions

To make IIS deny access to the site example.com from clients that have made more than 9 concurrent HTTP requests:

plesk bin virtdir.exe --update / -vhost example.com -is_deny_by_concurrent_requests true -max_concurrent_requests 9

-max_concurrent_requests <number>

Sets the maximum number of concurrent requests. Is 5 by default.

Is used with the -ip_deny_by_concurrent_requests option.

 
-is_deny_by_request_rate true|false

Sets dynamic denying of IP addresses based on the number of requests over a period of time. Applies to the root virtual directory.

Learn more at http://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-dynamic-ip-address-restrictions

To make IIS deny access to the site example.com from clients that have made more than 22 HTTP requests in 230 milliseconds:

plesk bin virtdir.exe --update / -vhost example.com -is_deny_by_request_rate true -max_requests 22 -request_interval 230

-max_requests <number>

Sets the maximum number of requests. Is 20 by default.

Is used with the -ip_deny_by_request_rate option.

 
-request_interval <number>

Sets a time period (in milliseconds). Is 200 by default.

Is used with the -ip_deny_by_request_rate option.