Installs a virtual directory.
Install-IisVirtualDirectory [-SiteName] <String> [-VirtualPath] <String> [-PhysicalPath] <String> [-Force] [<CommonParameters>]
The Install-IisVirtualDirectory function creates a virtual directory under website SiteName at /VirtualPath, serving files out of PhysicalPath. If a virtual directory at VirtualPath already exists, it is updated in palce. (Before Carbon 2.0, the virtual directory was deleted before installation.)
Beginning with Carbon 2.0.1, this function is available only if IIS is installed.
| Name | Type | Description | Required? | Pipeline Input | Default Value |
|---|---|---|---|---|---|
| SiteName | String | The site where the virtual directory should be created. |
true | false | |
| VirtualPath | String | The name of the virtual directory. This can contain multiple directory segments for virtual directories not at the root of the website, e.g. First/Second/VirtualDirectory. |
true | false | |
| PhysicalPath | String | The file system path to the virtual directory. |
true | false | |
| Force | SwitchParameter | Deletes the virttual directory before installation, if it exists. Preserves default beheaviro in Carbon before 2.0. Does not delete custom configuration for the virtual directory, just the virtual directory. If you've customized the location of the virtual directory, those customizations will remain in place. The |
false | false | False |
Install-IisVirtualDirectory -SiteName 'Peanuts' -VirtualPath 'DogHouse' -PhysicalPath C:\Peanuts\Doghouse
Creates a /DogHouse virtual directory, which serves files from the C:\Peanuts\Doghouse directory. If the Peanuts website responds to hostname peanuts.com, the virtual directory is accessible at peanuts.com/DogHouse.
Install-IisVirtualDirectory -SiteName 'Peanuts' -VirtualPath 'Brown/Snoopy/DogHouse' -PhysicalPath C:\Peanuts\DogHouse
Creates a DogHouse virtual directory under the Peanuts website at /Brown/Snoopy/DogHouse serving files out of the C:\Peanuts\DogHouse directory. If the Peanuts website responds to hostname peanuts.com, the virtual directory is accessible at peanuts.com/Brown/Snoopy/DogHouse.