Skip to main content

Automation Scripts

Automation scripts let you codify recurring MSP tasks, run them on demand or on a schedule, and trigger them automatically when alerts fire. Build your own library or share scripts with the broader MSP community via the MSP Collective marketplace.

Script Library

The RMM console includes a built-in library of scripts for common MSP tasks:

CategoryExample Scripts
MaintenanceClear temp files, flush DNS cache, defrag disk
DiagnosticsTest network connectivity, check event log errors, list installed apps
SecurityForce Windows Defender scan, check for pending reboots, audit local admins
ReportingSystem inventory report, disk usage summary, uptime report
SoftwareInstall/update Chocolatey packages, deploy software via silent installer

Browse the library at Scripts → Library. Scripts from the library can be run as-is or cloned and customized.

Writing Custom Scripts

  1. Navigate to Scripts → My Scripts.
  2. Click New Script.
  3. Fill in the script details:
    • Name — descriptive name for the script
    • Description — what it does and when to use it
    • Platform — Windows, macOS, Linux, or Cross-Platform
    • Command Typepowershell, bash, or shell
    • Script Body — the code

Example PowerShell script:

param(
[string]$MinFreeGB = "10"
)

$drives = Get-PSDrive -PSProvider FileSystem
foreach ($drive in $drives) {
$freeGB = [math]::Round($drive.Free / 1GB, 2)
if ($freeGB -lt [int]$MinFreeGB) {
Write-Output "WARNING: Drive $($drive.Name) has only ${freeGB}GB free"
} else {
Write-Output "OK: Drive $($drive.Name) has ${freeGB}GB free"
}
}
  1. Click Save as Draft. Scripts in draft are only visible to you.
  2. Submit for approval (see Script Approval Workflow).

Script Parameters

Scripts can accept parameters that are provided at run time or configured when scheduling.

Declare parameters at the top of your script:

PowerShell:

param(
[string]$TargetPath = "C:\Temp",
[int]$DaysOld = 30
)

Bash:

TARGET_PATH="${1:-/tmp}"
DAYS_OLD="${2:-30}"

Parameters appear as input fields in the RMM console when you run or schedule the script.

Running Scripts on a Schedule

  1. Open a script from Scripts → My Scripts or Scripts → Library.
  2. Click Schedule.
  3. Configure the schedule:
    • Frequency — hourly, daily, weekly, monthly
    • Time — start time and timezone
    • Target — device group or specific devices
    • Parameters — set fixed parameter values for scheduled runs
  4. Click Save Schedule.

Scheduled scripts appear under Scripts → Schedules where you can enable, disable, or delete them.

Alert-Triggered Scripts

Automatically run a script when an alert fires:

  1. Navigate to Alert Rules and open an existing rule or create a new one.
  2. In the Actions section, add action Run Script.
  3. Select the script from your approved library.
  4. Optionally set parameters for the script.
  5. Save the alert rule.

When the alert triggers, the script runs on the affected device. Output is captured and linked from the alert event in the alert history.

Example use case: When a service alert fires (service stopped), automatically run a restart script:

param([string]$ServiceName)
Start-Service -Name $ServiceName -ErrorAction Stop
Write-Output "Service $ServiceName restarted successfully"

Script Output and Logging

  • Output is captured from stdout and stderr.
  • Runs appear under Scripts → Run History with status and output.
  • Each run is linked to the device it ran on.
  • Output is retained for 30 days.
  • Download output as a text file from the Run Detail view.

Script Approval Workflow

All scripts must be approved by an administrator before they can be scheduled, alert-triggered, or shared.

  1. Write your script and click Submit for Approval.
  2. An admin receives a notification and can review the script at Scripts → Pending Approval.
  3. The admin reviews the code, tests it if needed, and clicks Approve or Reject with feedback.
  4. Approved scripts move to the Approved library and become available for scheduling and alert actions.
Why Approval?

Automation scripts run with agent-level privileges on endpoints. Requiring admin approval prevents accidental or malicious scripts from executing across your fleet.

Sharing Scripts to MSP Collective

Share approved scripts with the MSP community:

  1. Open an approved script.
  2. Click Share to Collective.
  3. Add a public title, description, tags, and usage examples.
  4. Submit. Your script is published to the MSP Collective marketplace.
  5. Other MSPs can discover, use, and rate your script.

Scripts you import from MSP Collective go through the same local approval workflow before use.