--- title: "Ensure Site Binding" ---
This is generated from the built in components of BuildMaster 2024.0, and may be different than what you have installed (especially if you have extensions); go to [Gear Icon] -> Administration -> Operations within your BuildMaster 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
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
);