New-WebApplication

Creates an IIS web application.

Syntax

New-WebApplication
   [-Site <String>]
   [-Name] <String>
   [-PhysicalPath <String>]
   [-ApplicationPool <String>]
   [-Force]
   [<CommonParameters>]

Description

The New-WebApplication cmdlet creates an Internet Information Services (IIS) web application.

Examples

Example 1: Create a web application

IIS:\> New-WebApplication -Name "TestApp" -Site "Default Web Site" -PhysicalPath "C:\Test" -ApplicationPool "DefaultAppPool"

This command creates a web application named TestApp on the default website. The application files are stored in the C:\Test folder, and the application runs in the DefaultAppPool application pool.

Parameters

-ApplicationPool

Specifies the name of the application pool in which the new web application runs.

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

-Force

Forces the creation of the application without prompting 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 web application to create.

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

-PhysicalPath

Specifies the physical path to the web application files.

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

-Site

Specifies the name of the site on which this cmdlet creates an application.

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