Edit

Share via


ConvertTo-WebApplication

Converts an IIS virtual directory to an IIS web application.

Syntax

Default (Default)

ConvertTo-WebApplication
    [-ApplicationPool <String>]
    [-Force]
    [[-PSPath] <String[]>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The ConvertTo-WebApplication cmdlet converts an Internet Information Services (IIS) virtual directory to an IIS web application.

Examples

Example 1: Convert a virtual directory to a web application

IIS:\> Md $Env:systemdrive\inetpub\Contoso
IIS:\> New-WebVirtualDirectory -Site "Default Web Site" -Name "ContosoVDir" -PhysicalPath "$Env:systemdrive\inetpub\Contoso"
IIS:\> ConvertTo-WebApplication -PSPath "IIS:\Sites\Default Web Site\ContosoVDir"

The first command creates a physical directory named Contoso.

The second command creates a virtual directory in IIS that uses that physical directory.

The last command converts the virtual directory to a web application.

Parameters

-ApplicationPool

Specifies the application pool in which the application runs.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Force

Forces the command to run without asking for user confirmation.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PSPath

Specifies the configuration path. This can be either an IIS configuration path in the format computer name/webroot/apphost, or the IIS module path in the format IIS:\sites\Default Web Site.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:1
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.