Ensure Site
  • 17 Feb 2022
  • 1 Minute to read
  • Dark
    Light
  • PDF

Ensure Site

  • Dark
    Light
  • PDF

Article Summary

This is generated from the built in components of Otter 3.0.0, and may be different than what you have installed (especially if you have extensions); go to [User Icon] -> Documentation within your BuildMaster instance to see exactly what operations are available.

Ensure Site

Ensures the existence of a site on a server.

Script usage:

IIS::Ensure-Site(
	Name: <text>,
	[AppPool: <text>],
	[Path: <text>],
	[Binding: <text>],
	[Bindings: <@(%(key1: value1, ...))>],
	[BindingProtocol: <text>],
	[BindingAddress: <text>],
	[BindingHostName: <text>],
	[BindingPort: <integer>],
	[BindingCertficiate: <text>],
	[BindingCertificateStoreLocation: <integer>],
	[BindingCertificateHash: <text>],
	[BindingRequireSNI: <true/false>],
	[BindingCertificateStore: <text>],
	[Exists: <true/false>]
);

Arguments:

NameFormatScript UsageUsage Notes
☆ Name
text
Name
The unique name of the IIS site or application pool. This argument is required.
Application pool
text
AppPool
The name of the application pool assigned to the site.
Virtual directory physical path
text
Path
The path to the web site files on disk.
Binding
text
Binding
Bindings
@(%(key1: value1, ...))
Bindings
Bindings are entered as a list of maps, e.g.:
@(%(IPAddress: 192.0.2.100, Port: 80, HostName: example.com, Protocol: http), %(IPAddress: 192.0.2.101, Port: 443, HostName: secure.example.com, Protocol: https, CertificateStoreName: WebHosting, CertificateHash: 51599BF2909EA984793481F0DF946C57E4FD5DEA, ServerNameIndication: true, UseCentralizedStore: false))
BindingProtocol
text
BindingProtocol
IP address
text
BindingAddress
Host name
text
BindingHostName
BindingPort
integer
BindingPort
SSL certificate
text
BindingCertficiate
Certificate store location
integer
BindingCertificateStoreLocation
SSL certificate hash
text
BindingCertificateHash
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
BindingRequireSNI
SSL certificate store
text
BindingCertificateStore
Exists
true/false
Exists

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,
    Bindings: @(%(IPAddress: 192.0.2.100, Port: 80, HostName: example.com, Protocol: http))
);

# ensures that the Default Web Site is removed from the web server
IIS::Ensure-Site(
    Name: Default Web Site,
    Exists: false
);

Was this article helpful?