Otter Documentation

services - Ensure Service

  • Last Modified: 2019-07-30

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

Ensure Service

Ensures the configuration of a Windows service on a server.

Operation type:

Ensuring - this operation will ensure a specified configuration exists on a remote server after comparing its current state to the desired state.

Script usage:

Ensure-Service(
	Name: <text>,
	[DisplayName: <text>],
	[Description: <text>],
	[Status: <integer>],
	[Exists: <true/false>],
	Path: <text>,
	[Startup: <integer>],
	[DelayedStart: <true/false>],
	[Credentials: <text>],
	[UserName: <text>],
	[Password: <text>],
	[FirstFailure: <integer>],
	[SecondFailure: <integer>],
	[SubsequentFailures: <integer>],
	[RestartDelay: <integer>],
	[OnFailureProgramPath: <text>],
	[RebootMessage: <text>],
	[Dependencies: <@(text)>],
	[StatusChangeTimeout: <TimeSpan>]
);

This operation may be prefixed with Windows::, although this is a built-in namespace and isn't really necessary.

Arguments:

Name Format Script Usage Usage Notes
🔑 Name
text
Name
This argument is the unique key for this operation, which means it must uniquely identify the target of the operation. This argument is required.
Display name
text
DisplayName
Description
text
Description
Status
integer
Status
Exists
true/false
Exists
Path w/ arguments
text
Path
The executable path of the service. This field may include any arguments that will be supplied to the executable. Executable paths that include spaces should be wrapped with double-quotes, e.g.: "C:\Program Files\Hdars\Hdars.Service.exe" -arg1 -arg2 This argument is required.
Startup
integer
Startup
Startup type
DelayedStart
true/false
DelayedStart
Delayed start
Credentials
text
Credentials
The Otter credential name to use as the service's Log On user. If a credential name is specified, the username and password fields will be ignored.
User name
text
UserName
The user account name to run the service as. If this value is not supplied, NT AUTHORITY\LocalSystem will be assumed.
Password
text
Password
The password for the account that runs the service. If NT AUTHORITY\LocalSystem is specified, this field must not have a value set.
First failure
integer
FirstFailure
Second failure
integer
SecondFailure
Subsequent failures
integer
SubsequentFailures
Restart delay
integer
RestartDelay
Run program
text
OnFailureProgramPath
Reboot message
text
RebootMessage
Dependencies
@(text)
Dependencies
Status change timeout
TimeSpan
StatusChangeTimeout
The number of seconds to wait for a server to change between two statuses (e.g. stopped to starting) before raising an error.

Example:

# ensures the HdarsSvc is present on the server using the HdarsSvc credentials in Otter
Windows::Ensure-Service
(
    Name: HdarsSvc,
    DisplayName: HDARS Console Log Service,
    Status: Running,
    Path: E:\Services\Hdars.Service.exe,
    Startup: Auto,
    Credentials: HdarsSvc,
    FirstFailure: Restart
);

Is this documentation incorrect or incomplete? Help us by contributing!

This documentation is licensed under CC-BY-SA-4.0 and stored in GitHub.

Generated from commit ce197caa on master