Services - List
Declaration
<AMSERVICES ACTIVITY="list" REMOTEMACHINE="text" REMOTEDOMAIN="text" REMOTEUSERNAME="text" REMOTEPASSWORD="text (encrypted)" RESULTDATASET="text" />
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 Desktop dataset. Once the dataset is created, other activities 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 a service
located on the local computer. This parameter is enabled by default.
If this parameter is selected, the Another
computer parameter becomes inactive. NOTE: This parameter does not contain markup and is only displayed in visual mode for task construction and configuration purposes. |
Another computer | --- | --- | --- | --- | If
enabled, indicates that this activity will be performed on a service
located on a remote computer. The parameters below become active
if this parameter is enabled. NOTE: This parameter does not contain markup and is only displayed in visual mode for task construction and configuration purposes. |
Computer | Text | Yes, if set to Another computer | (Empty) | REMOTEMACHINE="MachineName" | The computer name of the remote machine in which to connect to. |
Domain | Text | Yes, if set to Another computer | (Empty) | REMOTEDOMAIN="DomainName" | The domain that the remote machine belongs to. |
Username | Text | Yes, if set to Another computer | (Empty) | REMOTEUSERNAME="Username" | The username to use to sign in to the remote machine. This user must have the appropriate permissions to modify services on the remote machine. |
Password | Text | Yes, if set to Another computer | (Empty) | REMOTEPASSWORD="password" | The password to use to authenticate with the Username parameter. |
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:
|
Example
- Copy and paste the sample AML code below directly into the Task Builder Steps Panel.
- To successfully run the sample code, update parameters containing user credentials, files, file paths, or other information specific to the task to match your environment.
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.
<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" />