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.

Select one of the following options to create a new Client Task:

Click Tasks > New > add_new_defaultClient Task.

Click Tasks > select the desired task type and click New > add_new_defaultClient Task.

Click the target device in Computers and select icon_tasks Tasks > add_new_defaultNew Task.


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, type 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 - Type a command line you want to run on the client(s).

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


important

You can type 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 macOS can process the full length of the command. Windows has a restriction for maximum 8,191 characters.


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 type:

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 small 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.

Examine the Run Command task output

1.Click Tasks > click the task > Show Details > Executions tab > click a line in the table > icon_history History.

2.The Trace Message column contains the first 255 characters of the Run Command task output. You can create reports and process this data from several computers. You can download a bigger output as a Log Collector log in Computer Details > Logs > Log Collector.