Services - List

Declaration

<AMSERVICES ACTIVITY="list" REMOTEMACHINE="text" REMOTEDOMAIN="text" REMOTEUSERNAME="text" REMOTEPASSWORD="text" RESULTDATASET="text" />

Related Topics   

Description

Retrieves all services installed locally or on a remote machine and populates a dataset with their service name, display name and current state.

Practical Usage

Used to place a list of all system services into an Automate dataset. Once the dataset is created, other actions such as Loop Dataset can be used to access the data.

Parameters

Service

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 under Datasets.

Include devices

Yes/No

No

No

INCLUDEDRIVERS="YES"

If selected, indicates that device driver information will be included in the dataset. This parameter is disabled by default and available only local services are specified.

Computer

Property

Type

Required

Default

Markup

Description

Local computer

---

---

---

---

If enabled, indicates that this activity will be performed on services located on the local computer. This parameter is enabled by default. If this parameter is selected, the Another computer parameter becomes inactive. This is a visual mode parameter used during design time only, therefore, it contains no markups.

Another computer

---

---

---

---

If enabled, indicates that this activity will be performed on a services located on a remote computer. The parameters below become active if this parameter is enabled. This is a visual mode parameter used during design time only, therefore, it contains no markups.

Computer

Text

Yes

(Empty)

REMOTEMACHINE="MachineName"

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

Domain

Text

Yes

(Empty)

REMOTEDOMAIN="DomainName"

The domain that the remote machine belongs to.

Username

Text

Yes

(Empty)

REMOTEUSERNAME="Username"

A valid username 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 username entered above.

 

Description

Error Causes

On Error

additional notes

Datasets

A dataset is a multiple column, multiple row container object. This activity creates and populates a dataset containing a specific set of fields in addition to the standard dataset fields. The table below describes these fields (assuming the dataset name assigned was theDataset).

Name

Type

Return Value

theDataset.ServiceName

Text

Returns the name of the service as it appears in the General tab of the service's properties under Service Name.

theDataset.DisplayName

Text

Returns the friendly name of the service as it appears in the General tab of the service's properties under Display Name.

theDataset.Status

Text

Returns the current state of the service. Possible values for a service state are:

  • Stopped

  • StartPending

  • StopPending

  • Running

  • ContinuePending

  • PausePending

  • Paused

Example

NOTE:
  • The sample AML code below can be copied and pasted directly into the Steps Panel of the Task Builder.
  • Parameters containing user credentials, files, file paths, and/or other information specific to the task must be customized before the sample code can run successfully.

Description

The list of local services are populated into a dataset. A Loop Dataset activity loops through each field (row) of the dataset. During each iteration, information about the current service is displayed in a message dialog. Press Cancel to end the task.

Copy
<AMSERVICES ACTIVITY="list" RESULTDATASET="theDataset" />
<AMLOOP ACTIVITY="dataset" DATASET="theDataset" />
<AMSHOWDIALOG WINDOWTITLE="Service Information " BUTTONS="ok_cancel" ONSECONDBUTTONCLICK="stop">Service Name - %theDataset.ServiceName%Service Display Name - %theDataset.DisplayName%Service Status - %theDataset.Status%</AMSHOWDIALOG>
<AMLOOP ACTIVITY="end" />