New-WebVirtualDirectory

Creates a virtual directory in IIS.

Syntax

New-WebVirtualDirectory
   [-Site <String>]
   [-Application <String>]
   [-Name] <String>
   [-PhysicalPath <String>]
   [-Force]
   [<CommonParameters>]

Description

The New-WebVirtualDirectory cmdlet creates a virtual directory in Internet Information Services (IIS).

Examples

Example 1: Create a virtual directory

IIS:\> New-WebVirtualDirectory -Site "Default Web Site" -Name "ContosoVDir" -PhysicalPath "c:\inetpub\contoso"

This command creates a virtual directory named ContosoVDir on the default website.

Parameters

-Application

Specifies the name of a web application under which this cmdlet creates the virtual directory.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Force

Forces the command to run without asking for user confirmation.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Name

Specifies the name of the new virtual directory.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-PhysicalPath

Specifies the physical path to the folder in which this cmdlet creates the virtual directory. The specified folder must already exist.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Site

Specifies the name of the site under which this cmdlet creates the virtual directory.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False