Check Status

Object to check the status of Windows services

Settings

Field

Descriptive

Title

Object title

Object Identifier Name

Singular name for this object

Service Name

Name of the service to be checked

Return

Type

Description

Stopped

WindowsServiceStatus

Stopped service

StartPending

WindowsServiceStatus

Service with pending initialization

StopPending

WindowsServiceStatus

Service with pending stop

Running

WindowsServiceStatus

Service is running

ContinuePending

WindowsServiceStatus

Service with pending execution

PausePending

WindowsServiceStatus

Service with pending pause

Paused

WindowsServiceStatus

Paused service

NotFound

WindowsServiceStatus

Service not found

Check Return

A verificação retornará uma variável com a propriedade Status. - The check will return a variable with the Status property .

How to Use

For this tutorial, the unique name of the object has been declared as "statusService", i.e. to access the property containing the status of the service you only need to include dot Status. (statusService.Status).

Example

1 - Select the object "Check Status" in the Windows menu.

2 - Next, to check the return, you can use the IF condition object, located in the "Command Blocks" menu. The included condition should be as follows:

//Serviço em execução
statusService.Status == WindowsServiceStatus.Running
//Serviço parado
statusService.Status == WindowsServiceStatus.Stopped
//Serviço com inicialização pendente
statusService.Status == WindowsServiceStatus.StartPending
//Serviço com paralização pendente
statusService.Status == WindowsServiceStatus.StopPending
//Serviço com execução pendente
statusService.Status == WindowsServiceStatus.ContinuePending
//Serviço com pausa pendente
statusService.Status == WindowsServiceStatus.PausePending
//Serviço com pausado
statusService.Status == WindowsServiceStatus.Paused
//Retorno quando o nome do serviço informado não é encontrado
statusService.Status == WindowsServiceStatus.NotFound

The working area will look like this:

Last updated

Was this helpful?