Returns the current status of a service. This service can be found on the local computer or on a remote computer.
// Returns the status of the service found in TABLE_Service
Result1 is int
Result1 = ServiceStatus(COL_Name[TABLE_Service])
IF Result1 = -1 THEN
Error(ErrorInfo())
ELSE
// Call a specific WLanguage procedure to convert the result to text
Info("Status of the service: " + StatusInText(Result1))
END
Syntax
<Result> = ServiceStatus(<Service name> [, <Remote computer>])
<Result>: Integer constant
- -1 if an error occurred. To get more details on the error, use ErrorInfo,
- Current status of the service:
| |
serviceStatusPaused | The service is paused. |
serviceStatusPausing | The service received a command to pause but it has not been paused yet. |
serviceStatusRestarting | The service received a command to restart but it has not been restarted yet. |
serviceStatusStarted | The service is currently operating. |
serviceStatusStarting | The service received a command to start but it has not been started yet. |
serviceStatusStopped | The service is stopped. |
serviceStatusStopping | The service received a command to stop but it has not been stopped yet. |
<Service name>: Character string
Name of service to check.
<Remote computer>: Optional character string
IP address of the remote computer in xxx.xxx.xxx.xxx format (returned by NetIPAddress) or name of the remote computer (returned by NetMachineName). This parameter is used to control a service on another computer. To use this option, the user must be administrator of remote computer.
If this parameter is not specified or if it corresponds to an empty string (""), the service is handled locally.