Run Command

The Run Command task can be used to execute specific command line instructions on the client. The administrator can specify the command line input to run.

To create the task, click Tasks > New > add_new_defaultClient Task or click the desired client device in Computers and select New Task.

important

Important

Commands are executed without access to a desktop environment. As a result, the execution of commands with requirements to the application's GUI may fail.

You can use ecmd commands with the Run Command task. For more information, visit the following Knowledgebase article.

Operating System

Command will run as user

Default working directory

Accessible network locations

Command will be run in

Windows

Local System

C:\Windows\Temp

Only locations in the current domain and available to user Local System

Command prompt (cmd.exe)

Linux or macOS

root

/tmp

Only if location is mounted and available to root user

Console

Basic

In the Basic section, enter basic information about the task, such as a Name and Description (optional). Click Select tags to assign tags.
In the Task drop-down menu, select the task type you want to create and configure. If you have selected a specific task type before creating a new task, Task is pre-selected based on your previous choice. Task (see the list of all Tasks) defines the settings and the behavior for the task.

Settings

Command line to run - Enter a command line you want to run on the client(s).

Working directory - Enter a directory where the command line above will be executed.

important

Important

You can enter a multi-line command.

Maximum command length restrictions:

Web Console can process up to 32,768 characters. If you copy-paste a longer command, it would silently cut off the end.

Linux and Mac are able to process the full length of the command. Windows has restriction for maximum 8,191 characters (read more here).

example

Example

To run a local script located on a client at C:\Users\user\script.bat follow these steps:

1.Create a new Client Task and select Run Command.

2.In the Settings section enter:

Command line to run: call script.bat
Working Directory: C:\Users\user

3.Click Finish, create a trigger and choose target clients.

To run a multi-line command to restart a Windows service remotely (replace service_name with the service name, for example wuauserv for the Windows Update service):

net stop service_name

net start service_name

Summary

Review the summary of configured settings and click Finish. The Client Task is now created and a pop-up window will open:

Click Create Trigger (recommended) to specify Client Task Targets (computers or groups) and the Trigger.

If you click Close, you can create a Trigger later - Click the Client Task instance and select restart_default Run on from the drop-down menu.

client_task_finish

You can see the progress indicator bar, status icon, and details for each created task in Tasks.