Editar

Partilhar via


New-IISSite

Creates an IIS Website.

Syntax

New-IISSite
   [-Name] <String>
   [-PhysicalPath] <String>
   [-BindingInformation] <String>
   [[-Protocol] <String>]
   [[-CertificateThumbPrint] <String>]
   [[-SslFlag] <SslFlags>]
   [[-CertStoreLocation] <String>]
   [-Force]
   [-Passthru]
   [<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.

Example 3: Add a new website of HTTPS binding

PS C:\> New-IISSite -Name "TestSite" -PhysicalPath "$env:systemdrive\inetpub\testsite" -BindingInformation "*:443:" -CertificateThumbPrint "D043B153FCEFD5011B9C28E186A60B9F13103363" -CertStoreLocation "Cert:\LocalMachine\Webhosting" -Protocol https

This command creates a website named TestSite with HTTPS binding

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 are indicated by leaving the corresponding field blank.

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

-CertificateThumbPrint

Specifies a certificate thumbprint, which is used to add a new HTTPS binding

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

-CertStoreLocation

Specifies the certificate store path of the certificate, which is used to add a new HTTPS binding

Type:String
Accepted values:Cert:\LocalMachine\My, Cert:\LocalMachine\WebHosting, My, WebHosting
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

-Name

Specifies the name of the IIS website.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
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
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-PhysicalPath

Specifies the physical path to the new IIS website.

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

-Protocol

The protocol for which the binding is configured, usually http, https or ftp.

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

-SslFlag

Specifies the SSL flag settings of the new binding.

Type:SslFlags
Accepted values:None, Sni, CentralCertStore, DisableHTTP2, DisableOCSPStp, DisableQUIC, DisableTLS13, DisableLegacyTLS
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

Inputs

String

SslFlags

Outputs

Object