Skip to main content

Scripts

The library​

Scripts lists your tenant's scripts and the global ones (read-only, shared by the global admins). Technicians can run scripts; tenant admins also create and edit them.

A script has:

FieldMeaning
Name, descriptionShown in the library.
LanguagePowerShell (Windows PowerShell 5.1), PowerShell 7 (pwsh.exe, must be installed on the device), or cmd.
Run asSystem or the logged-on user.
TimeoutHow long it may run; the process tree is killed after that.
ParametersTyped inputs, rendered as a form when the script is run.
ScriptThe content, edited in a code editor.

Parameters​

Each parameter has a name, a type (string, integer, number or boolean), a title, an optional default, and optionally a list of allowed values, a minimum/maximum or a maximum length, and whether it is required. The server validates values against these rules before a run.

The script receives each parameter twice:

  • as an environment variable RMM_PARAM_<NAME> (booleans are true / false);

  • for PowerShell, also as a named parameter, so the script can declare:

    param([string]$Name, [int]$Days, [switch]$Force)

Values are never pasted into the script text.

cmd scripts

For cmd scripts, string values cannot contain & | < > ^ % ! ", because a batch file would treat them as commands.

Versions​

Every change to the content or parameters creates a new version. The History tab lists them with a diff. Runs record which version they used. Deleting a script removes it from the library but keeps its runs.

Run a script​

Open a script, choose Run, fill in the parameters, pick the devices (selected devices, a filter or all devices) and start. One run is created per device.

Script runs​

Script runs lists every run with its device, script, status (queued, running, succeeded, failed, timeout, cancelled) and exit code. A run's page shows:

  • the output, streamed live while the script runs (stdout and stderr in order);
  • the exit code and error;
  • for long output, the complete output file: the agent uploads anything above 64 KiB (up to 10 MiB; beyond that the run is marked truncated).

A queued or running run can be cancelled.