Scripts
The library
Automation → 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:
| Field | Meaning |
|---|---|
| Name, description | Shown in the library. |
| Language | PowerShell (Windows PowerShell 5.1), PowerShell 7 (pwsh.exe, must be installed on the device), or cmd. |
| Run as | System or the logged-on user. |
| Timeout | How long it may run; the process tree is killed after that. |
| Parameters | Typed inputs, rendered as a form when the script is run. |
| Script | The 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 aretrue/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.
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.
Finding a script
The library is a runbook: search by name (or type language: cmd), or press
All, PowerShell, PowerShell 7 or CMD. Each entry gives the
description, the parameters it asks for (asks for Days, Drive, or no input),
the language, runs as system unless it runs as the user, the current version and
when the script last ran (or never run), with Run beside it for those who
may run scripts, and marks only the exceptions: Runs as the logged-on
user and Global. The whole row opens the script. When nothing matches,
Clear search removes the search and filter.
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 (Run history on Automation → Scripts) 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.