New-IISSite

Creates an IIS Web site.

Syntax

New-IISSite
   -BindingInformation <String>
   [-Force]
   -Name <String>
   [-Passthru]
   -PhysicalPath <String>
   [<CommonParameters>]

Description

The New-IISSite cmdlet is used to create an Internet Information Services (IIS) website with the given physical site as the root and binding information to listen on a specific IP:Port:Hostname binding.

Examples

Example 1: Add a new IIS web site

PS C:\> New-IISSite -Name "TestSite" -BindingInformation "*:8080:" -PhysicalPath "$env:systemdrive\inetpub\testsite"

This command creates a new website named TestSite.

Example 2: Add a new website and set application pool of the site default application to a custom name

PS C:\> Start-IISCommitDelay
PS C:\> $TestSite = New-IISSite -Name TestSite -BindingInformation "*:8080:" -PhysicalPath "$env:systemdrive\inetpub\testsite" -Passthru
PS C:\> $TestSite.Applications["/"].ApplicationPoolName = "TestSiteAppPool"
PS C:\> Stop-IISCommitDelay

This command creates a website named TestSite with default application assigned to the TestSiteAppPool application pool.

Required Parameters

-BindingInformation

Specifies the binding information string to use for the new site. The binding information of the form IP:Port:hostname such as 192.168.0.1:80:www.contoso.com and one or more of the fields can be left blank, which is equivalent to using a wildcard character such as *:443:. In this representation * indicates all IP addresses and all hostnames is indicated by leaving the corresponding field blank.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Name

Specifies the name of the IIS website.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-PhysicalPath

Specifies the physical path to the new IIS website.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional Parameters

-Force

Forces the command to run without asking for user confirmation.

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

Returns an object representing the item with which you are working. By default, this cmdlet does not generate any output.

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

Inputs

String

Outputs

Microsoft.Web.Administration.Site