Skip to content

Windows service

Allows you to control Windows services on remote servers. You can start, stop, restart services, or check their current status.

Parameters

  • Server - Specify the Windows server or servers where the service is located. Multiple servers can be selected.
  • Service - Name of the Windows Service to control (e.g., "Spooler", "W32Time", "wuauserv").
  • Action - Select the action to perform on the service:
  • Start - Start the service if it's not running
  • Stop - Stop the service if it's running
  • Restart - Stop and then start the service
  • Status - Check the current status of the service without making changes
  • Errors - Define how to handle errors if the action fails:
  • Fail - Throw an error and stop execution (default)
  • Warn - Log a warning but continue execution
  • Silent - Ignore errors silently
  • Wait until status - (Optional) Wait for the service to reach the expected status after the action
  • Wait timeout (seconds, 0=infinite) - Maximum time to wait for status change. Set to 0 for infinite wait. Default is 0.

Return Value

This service returns a hash structure with server names as keys and service statuses as values:

{
    'Server1' => 'RUNNING',
    'Server2' => 'STOPPED',
    ...
}

Possible service statuses are:

  • RUNNING - The service is currently running
  • STOPPED - The service is stopped
  • START_PENDING - The service is starting
  • STOP_PENDING - The service is stopping
  • PAUSE_PENDING - The service is pausing
  • CONTINUE_PENDING - The service is resuming after a pause
  • PAUSED - The service is paused
  • SKIPPED - The server was inactive and skipped

Wait Functionality

When Wait until status is enabled: - For Start and Restart actions: waits until the service status is RUNNING - For Stop action: waits until the service status is STOPPED - The service polls every 2 seconds until the expected status is reached or timeout expires - If timeout is reached before the expected status, a warning is logged but execution continues

Usage Examples

Start a service and wait for it to be running

  1. Set Action to "Start"
  2. Enable Wait until status
  3. Set Wait timeout to 30 seconds
  4. The service will start and wait up to 30 seconds for the service to reach RUNNING status

Check service status on multiple servers

  1. Select multiple servers in the Server field
  2. Set Action to "Status"
  3. The service will return the current status of the service on each server

Restart a service with error handling

  1. Set Action to "Restart"
  2. Set Errors to "Warn" to continue even if restart fails
  3. The service will attempt to restart and log warnings on failure

Notes

  • This service uses the Windows sc query and net start/stop commands
  • Supports multilingual Windows servers (English, Spanish, etc.)
  • Status codes are language-independent, ensuring consistent results across different Windows locales
  • Inactive servers are automatically skipped with a warning message