Services - Get State |
<AMSERVICES ACTIVITY="state" SERVICE="text" REMOTEMACHINE="text" REMOTEDOMAIN="text" REMOTEUSERNAME="text" REMOTEPASSWORD="text (encrypted)" RESULTVARIABLE="text" /> |
Description:
Retrieves the state (e.g.,stopped, running, paused, etc.) of a particular service and populates a variable with the result. This activity supports local or remote services.
Ideally used to determine the current status of a local or remote service. With this activity, a task can be created to open an Excel file of computer names and check the service state on each of them. Thereafter, it can save the results in another log file.
Service
Property |
Type |
Required |
Default |
Markup |
Description |
Service name |
Text |
Yes |
(Empty) |
SERVICENAME="Task Scheduler" |
The name of the service in which to retrieve information about. This value can be entered manually or by pressing the down arrow to allow selection from a drop-down list of currently running services. This parameter supports entry of the "Service Name" or "Display Name" as specified in the Services console (services.msc) under the General tab properties of the service. |
Include devices in the list of services (local connection only) |
|
|
|
|
If enabled, indicates that device drivers will be included in the Service name parameter's drop-down list of services. This parameter is disabled by default and is not available if a remote service is specified. This is a design time parameter and therefore includes no markups. |
Place result into variable |
Text |
Yes |
(Empty) |
RESULTVARIABLE="VariableName" |
The variable to populate with the state of the service. Possible values for a service state are:
|
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. 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 service 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 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" |
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 if set to Another computer |
(Empty) |
REMOTEPASSWORD="password" |
The password associated with the username entered above. |
NOTE: The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder. |
Get state of local service named "Task Scheduler" and place it into variable named "theState"
<AMSERVICES ACTIVITY="state" SERVICE="Task Scheduler" RESULTVARIABLE="theState" />
|