New-Website

Creates an IIS website.

Syntax

New-Website
   [-Name] <String>
   [-Id <UInt32>]
   [-Port <UInt32>]
   [-IPAddress <String>]
   [-SslFlags <Int32>]
   [-HostHeader <String>]
   [-PhysicalPath <String>]
   [-ApplicationPool <String>]
   [-Ssl]
   [-Force]
   [<CommonParameters>]

Description

The New-Website cmdlet creates an Internet Information Services (IIS) website with the settings specified in parameter values.

Examples

Example 1: Create a website

IIS:\> New-WebSite -Name "TestSite" -Port 80 -HostHeader "TestSite" -PhysicalPath "$Env:systemdrive\inetpub\testsite"

This command creates a website named TestSite.

Parameters

-ApplicationPool

Specifies the application pool in which the new site runs.

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

-HostHeader

Specifies the host header of the new site.

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

-Id

Specifies the ID of the new site.

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

-IPAddress

Specifies the IP address of the new site.

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

-Name

Specifies the name of the new site.

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

-PhysicalPath

Specifies the physical path of the new site. The specified folder must already exist.

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

-Port

Specifies the port of the new site.

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

-Ssl

Indicates that this cmdlet enables HTTPS binding on the site.

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

-SslFlags

Indicates what type of certificate and certificate storage the new website supports. The acceptable values for this parameter are:

  • 0: Regular certificate in Windows certificate storage.

  • 1: SNI certificate.

  • 2: Central certificate store.

  • 3: SNI certificate in central certificate store.

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