Services Action

On Microsoft Windows operating systems, a Windows service is a long-running executable that performs specific functions and which is designed not to require user intervention. Windows services can be configured to start when the operating system is booted and run in the background as long as Windows is running, or they can be started manually when required. This action provides various ways to automate the management of local services or services that reside on a remote machine. Activities include starting, stopping, installing and uninstalling services.

Properties Tab

In the Activity to perform box, select an activity, then configure the properties for that activity. The available properties depend on the activity selected.

To set properties

  1. In the Available Actions pane, open the System folder and double-click the action or drag it into the Steps pane.

  1. On the Properties tab, select an Activity to perform.

  2. Specify the properties that appear, depending on the activity selected.

  3. To set the Description tab properties, refer to Description Tab Options.

  4. To set the Error Causes and On Error tab properties, refer to Step Error Handling.

  5. When finished, click OK to save settings and close the properties dialog box.

Available Activities

The following table briefly describes the available activities for this action as specified in the Activity to perform box.

Activity

Description

Declaration

Examples

Get State

Populates n variable with the current state of the specified service (i.e. Stopped, Running, Paused etc.)

<AMSERVICES ACTIVITY="state" SERVICE="text" REMOTEMACHINE="text" REMOTEDOMAIN="text" REMOTEUSERNAME="text" REMOTEPASSWORD="text=aME" RESULTVARIABLE="text" />

<AMSERVICES SERVICE="Task Scheduler" />

Install

Installs the specified service into the SCM (Service Control Manager) so that it can be started and stopped.

<AMSERVICES ACTIVITY="install" EXECUTABLE="text" DISPLAYNAME="text" USERNAME="text" PASSWORD="text" />

<AMSERVICES ACTIVITY="install" EXECUTABLE="c:\servicesname.exe" DISPLAYNAME="service name" USERNAME="username" PASSWORD="AM1H2tpzU1xiDLOlojMcSAm1fn5M3MxiXeEaME" />

List

Creates and populates the specified dataset with the services installed on the system along with their current state.

<AMSERVICES ACTIVITY="list" RESULTDATASET="text" />

<AMSERVICES ACTIVITY="list" RESULTDATASET="theDataset" />

Pause

Pauses the specified service.  

<AMSERVICES ACTIVITY="pause" SERVICE="text" />

<AMSERVICES ACTIVITY="pause" SERVICE="Task Scheduler" />

Resume

Resumes the specified service.  Only "paused" services can be resumed.

<AMSERVICES ACTIVITY="resume" SERVICE="textr" REMOTEMACHINE="text" REMOTEDOMAIN="text" REMOTEUSERNAME="text" REMOTEPASSWORD="text" />

<AMSERVICES ACTIVITY="resume" SERVICE="Task Scheduler" REMOTEMACHINE="machineName" REMOTEDOMAIN="domainName" REMOTEUSERNAME="User" REMOTEPASSWORD="AM1OiXpJbSzJyjOlojMcSAm1fn5M3MxiXeEaME" />

Start

Starts the specified service.

<AMSERVICES SERVICE="text" />

<AMSERVICES SERVICE="Task Scheduler" />

Stop

Stops the specified service.

<AMSERVICES ACTIVITY="stop" SERVICE="text" STOPIFMASTER="YES/NO" />

<AMSERVICES ACTIVITY="stop" SERVICE="Task Scheduler" STOPIFMASTER="YES" />

Uninstall

Uninstalls the specified service.

<AMSERVICES ACTIVITY="uninstall" SERVICE="text" REMOTEMACHINE="text" REMOTEDOMAIN="text" REMOTEUSERNAME="text" REMOTEPASSWORD="text" />

<AMSERVICES ACTIVITY="uninstall" SERVICE="Task Scheduler" REMOTEMACHINE="machine_name" REMOTEDOMAIN="domain.name" REMOTEUSERNAME="user" REMOTEPASSWORD="AM1H2tpzU1xiDL5+TNzMYl3hA==aME" />

Service Properties

Property

Type

Required

Default

Markup

Description

Create and populate dataset

Text

Yes

(Empty)

RESULTDATASET="theDataset"

The name of the dataset to create and populate the list of services. More on the fields that this dataset creates can be found below.

Display name

Text

Yes

(Empty)

DISPLAYNAME="My Service"

The name of the service as it should appear in the Service Control Manager (SMC).

Error Severity

Text (options)

No

Normal

ERROR="critical"

If the service generates an error, specifies how the error should be written to the system event log. The available options are:

  • Normal: Errors are logged as normal.

  • Ignore: Errors are ignored.

  • Critical: Errors are logged as critical.

  • Severe: Errors are logged as severe.

Force-stop dependent services as well

Yes/No

No

No

STOPIFMASTER="YES"

If set to YES, dependent services will be forced to stop as well. This parameter is set to NO by default.

Include devices in the list of services (local connection only)

       

If enabled, indicates that device services will be included in the drop-down list of services. This parameter is set to NO by default and is not available if a remote computer is specified.

Interactive Service

Yes/No

No

No

INTERACT="YES"

If set to YES, specifies that the service should be able to interact with the desktop. This parameter is set to NO by default. Although typically services do not have a user interface, developers can add forms and other UI components. In such cases, this parameter should be set to YES.

Path to service executable

Text

Yes

(Empty)

EXECUTABLE="c:\service.exe"

The full path and file name of the service to install.

NOTE: The executable file must be present on the target machine prior to installation.

Place result into variable

Text

Yes

(Empty)

RESULTVARIABLE="VariableName"

The variable to populate with the status of the service. Possible values for a service state are:

  • Stopped - The service is not running.

  • StartPending - The service is starting.

  • StopPending - The service is stopping.

  • Running - The service is running.

  • ContinuePending - The service continue is pending.

  • PausePending - The service pause is pending.

  • Paused - The service is paused.

Run type

Text (options)

No

Automatic

RUNTYPE="manual"

The service run type. The available options are:

  • Automatic: The service starts automatically when the system starts.

  • Manual: The service is not automatically started, it must be started manually through the SCM

  • Disabled: The service is disabled.

  • Boot: Driver specific setting.

  • System: Driver specific setting.

Service account password

Text

Yes

(Empty)

PASSWORD="password"

The password corresponding to the service account username.

Service account username

Text

Yes

(Empty)

USERNAME="username"

The username that the service should use to log on. The service automatically inherits the rights of the user specified in this field.

Service name

Text

Yes

(Empty)

SERVICENAME="Task Scheduler"

The name of the service in which to retrieve status information about. The value can be entered manually or a drop-down arrow is included to allow selection from a list of currently running services. This parameter supports entry of the 'service name' or 'display name' as specified in the General tab properties of the service.

Service type

Text (options)

No

Own Process

SERVICETYPE="shared_process"

The type of service to install. The available options are:

  • Runs in own process: The service runs in it's own process space.

  • Shared process: The service runs in a shared process space.

  • Kernel driver: The service is a kernel driver.

  • File system: The service is a file system driver.

Computer Tab

Property

Type

Required

Default

Markup

Description

Local computer

 

 

 

 

If enabled, indicates that the specified activity will be performed on a service located on the local computer. This parameter is enabled by default.

Another computer

 

 

 

 

If enabled, indicates that the selected activity will be performed on a service located on a remote computer. If this parameter is enabled, the Local computer parameter is ignored.  This parameter is disabled by default.

NOTE: Other parameters become active if this parameter is enabled.

When installing to another computer, the path to the service executable should be expressed in terms of the file's location on that computer (e.g., "C:\Service.exe" not "\\computer\c$\Service.exe")

Machine Name

Text

Yes

(Empty)

REMOTEMACHINE="MachineName"

The computer name of the remote machine in which to connect to.

Machine Domain

Text

Yes

(Empty)

REMOTEDOMAIN="DomainName"

The domain that the remote machine belongs to.

Username

Text

Yes

(Empty)

REMOTEUSERNAME="Username"

A valid user name used to log onto the remote machine. This user must have proper permissions to modify services on the remote machine.

Password

Text

Yes

(Empty)

REMOTEPASSWORD="password"

The password associated with the user name entered above.

Description Tab

This action includes the Description tab for entering a custom step description.

More on setting custom step description

Standard Error Handling Options

This action also includes the standard Error Causes and On Error failure handling options/tabs.

More on Error Handling Options

Variables and Expressions

All text fields allow the use of expressions, which can be entered by surrounding the expression in percentage signs (example: %MYVARIABLE%, % Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by pressing F2.

More on variables

More on expressions

More on the expression builder