--- title: "Ensure Site Binding" ---
This is generated from the built in components of Otter 2024.0, and may be different than what you have installed (especially if you have extensions); go to [Gear Icon] -> Administration -> Operations within your Otter instance to see exactly what operations are available.

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
IP address
text
Address
Host name
text
HostName
Port
integer
Port
SSL certificate
text
Certficiate
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
Exists
true/false
Exists

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
);