Edit

Share via


New-WebBinding

Adds a binding to a website.

Syntax

Default (Default)

New-WebBinding
    [[-Name] <String>]
    [-Protocol <String>]
    [-Port <UInt32>]
    [-IPAddress <String>]
    [-HostHeader <String>]
    [-SslFlags <Int32>]
    [-Force]
    [<CommonParameters>]

Description

The New-WebBinding cmdlet adds a new binding to an existing website.

Examples

Example 1: Add a new site binding

PS C:\> New-WebBinding -Name "Default Web Site" -IPAddress "*" -Port 80 -HostHeader "TestSite"

This command creates a binding on the default website.

Example 2: Add a new SSL site binding

PS C:\> New-WebBinding -Name "Default Web Site" -IPAddress "*" -Port 443 -HostHeader "TestSite" -Protocol "https"
PS C:\> (Get-WebBinding -Name "Default Web Site" -Port 443 -Protocol "https").AddSslCertificate("a909502dd82ae41433e6f83886b00d4277a32a7b", "my")

This command creates an SSL binding on the default website and adds a certificate with thumbprint a909502dd82ae41433e6f83886b00d4277a32a7b from the computer certificate store.

Parameters

-Force

Forces the creation of the binding.

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

-HostHeader

Specifies the host header of the new binding.

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

-IPAddress

Specifies the IP address of the new binding.

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

-Name

Specifies the name of the website on which this cmdlet creates the new binding.

Parameter properties

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

Parameter sets

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

-Port

Specifies the port for the new binding.

Parameter properties

Type:UInt32
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

-Protocol

Specifies the protocol for the new binding. This protocol is usually HTTP, HTTPS, or FTP.

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

-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.

Parameter properties

Type:Int32
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

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.