Skip to main content

Run Script on Another Device Action

Run a saved script on a selected runner device while keeping the automation's original device context.

Introduction

Use Run script on another device to execute a saved script on a selected runner device instead of the device moving through the automation. This is useful when a script needs tools, network access, or resources that are available on a dedicated device.

The automation still keeps the context of the device that entered the workflow. System variables, custom fields, and automation variables resolve from that workflow device before the script runs on the runner.


Prerequisites

Before adding this action:

  • Create the saved script you want to run.

  • Confirm that you can access the workflow device and the runner device.

  • Confirm that the runner has the operating system, tools, and network access the script requires.


Add the Action

  1. Open the automation and select Edit.

  2. Select + where you want to add the action.

  3. In the System category, select Run script on another device.

  4. In Runner device, search for and select the device that will execute the script.

  5. Select a saved script or create one.

  6. Configure any script-variable mappings, conditions, and additional options.

  7. Select Save.

Run script on another device action picker and runner device configuration

The runner is part of the action configuration. Every workflow device that reaches this action sends its rendered script to that selected runner.


Workflow Device and Runner Device Context

Remote execution separates the device being managed from the device doing the work.

Context

Device used

Trigger and action conditions

Workflow device

System variables such as {{ level_device_hostname }}

Workflow device

Custom field values

Workflow device

Automation variables

Current automation run for the workflow device

Script execution, operating system, installed tools, and network access

Runner device

Run as user context

Runner device

ℹ️ NOTE: A reference such as {{ level_device_hostname }} returns the workflow device's hostname, not the runner's hostname. Use the runner only as the place where the script executes.

Example

An automation runs for a workstation that cannot directly reach an internal management system. A server with the required tools and network access is selected as the runner. The script executes on the server while a variable such as {{ level_device_hostname }} still identifies the workstation moving through the automation.


Configure the Script

The saved script keeps its normal settings, including language, timeout, and Run as behavior. Those settings apply on the runner device.

If the script defines output variables, map them to automation variables in the action panel. Values returned by the runner are stored in the workflow device's automation run and are available to later actions.

See Run Script Action for script selection, variable mapping, output, exit-code, condition, and additional-option details that also apply here.

Configured Run script on another device action showing the selected runner, script, and variable mapping

Runner Availability and Failures

The runner must be available to receive and execute the action. If it does not respond, Level retries before the action times out and is marked as failed. The action's On action failure, retry, and timeout settings determine what the automation does next.

A script's exit code is evaluated from its execution on the runner:

Exit code

Result

0

Action marked as successful

Non-zero

Action marked as failed


Runner Device Usage

Level tracks when a device is used as an automation runner. A runner referenced by an active automation cannot be deleted until you remove or replace that automation usage.

⚠️ WARNING: Before changing or removing a runner, review every automation that uses it. Those automations depend on the runner's availability, tools, operating system, and network access.


FAQ

  • Does the script run on both devices? No. The runner executes the script. The workflow device provides the automation context and variable values.

  • Which device do system variables describe? They describe the workflow device moving through the automation.

  • Which operating system should the script support? The runner device's operating system.

  • What happens to script output variables? Mapped output is stored in the workflow device's automation run and can be used by later actions.

  • Why can't I delete the runner device? An active automation still references it. Open the device's automation usage, then remove or replace the runner in those automations.

For variable details, see System Variables and Automation Variables.

Did this answer your question?