Internet Explorer is no longer supported. Many things will still work, but your experience will be degraded and some things won't function. Please use a modern browser such as Edge, Chrome, or Firefox.

Ensure Site Binding

Ensures the existence of a binding on a site.

Script usage:

IIS::Ensure-SiteBinding(
	Site: <text>,
	[Protocol: <text>],
	[Address: <text>],
	[HostName: <text>],
	[Port: <integer>],
	[Certficiate: <text>],
	[CertificateStoreLocation: <integer>],
	[CertificateHash: <text>],
	[RequireSNI: <true/false>],
	[CertificateStore: <text>],
	[Exists: <true/false>]
);

Arguments:

NameFormatScript UsageUsage Notes
IIS site
text
Site
This argument is required.
Protocol
text
Protocol
Default value is "http".
IP address
text
Address
Default value is "*".
Host name
text
HostName
Port
integer
Port
Default value is "80".
SSL certificate
text
Certficiate
Value note: "friendly name, if not using "CertificateHash"".
Certificate store location
integer
CertificateStoreLocation
SSL certificate hash
text
CertificateHash
When specified, this value will be used to identify the SSL certificate by its thumbprint, and the "Certificate" and "CertificateStoreLocation" values will be ignored.
Require SNI
true/false
RequireSNI
SSL certificate store
text
CertificateStore
Default value is "My".
Exists
true/false
Exists
Default value is "True".

See also:

Example:


# ensures that the Otter web site is present on the web server, and binds the site to the single IP address 192.0.2.100 on port 80 and hostname "example.com"
IIS::Ensure-Site(
    Name: Otter,
    AppPool: OtterAppPool,
    Path: E:\Websites\Otter
);

IIS::Ensure-SiteBinding(
    Site: Otter,
    Protocol: http,
    Address: 192.0.2.100,
    Port: 80,
    HostName: example.com
);