Automation

Automate routine tasks with scripts, schedules, event triggers, and multi-step workflows.

Scripts

MaxRMM supports three scripting languages:

Language Extension Use Case
PowerShell .ps1 System administration, registry changes, service management, Windows API access
Batch .bat Simple file operations, legacy scripts, environment variable setup
Python .py Cross-platform logic, data processing, API integrations (requires Python installed on endpoint)

Creating a Script

Navigate to Scripts → Create Script:

  1. Enter a name and optional description
  2. Select the language (powershell, batch, or python)
  3. Write or paste the script body
  4. Optionally assign a category for organization

Global Scripts

MaxRMM includes a library of global scripts available to all tenants. These are read-only templates for common tasks. You cannot edit or delete global scripts, but you can clone them to create your own modified version.

Running a Script

To run a script on a specific agent:

  1. Go to Agents → select the agent → Commands
  2. Choose "Run Script" and select the script from your library
  3. The agent executes the script and reports the result (exit code, stdout, stderr)

Scheduled Scripts

Schedule scripts to run automatically on a recurring basis using cron expressions.

Creating a Schedule

Navigate to Automation → Schedules → Create Schedule:

Field Description
NameDescriptive name (e.g., "Weekly Disk Cleanup")
ScriptSelect from your script library
CronCron expression for the schedule (e.g., 0 2 * * 0 for every Sunday at 2 AM)
Agent FilterOptional filter to target specific agents (by tag, hostname pattern, or group)
EnabledToggle the schedule on or off

Cron Expression Examples

Expression Schedule
0 2 * * *Every day at 2:00 AM
0 2 * * 0Every Sunday at 2:00 AM
0 */4 * * *Every 4 hours
0 9 * * 1-5Weekdays at 9:00 AM
0 0 1 * *First day of every month at midnight

Event Triggers

Event triggers run a script automatically when a specific alert condition occurs. This enables self-healing — the system can detect and fix problems without human intervention.

Creating an Event Trigger

Navigate to Automation → Triggers → Create Trigger:

Field Description
NameDescriptive name (e.g., "Restart Print Spooler on Service Alert")
Alert CategoryWhich alert category triggers this (cpu, ram, disk, av, service, offline)
Alert SeverityOptional severity filter (only trigger on warning or critical alerts)
ScriptScript to execute when the trigger fires
Max RetriesHow many times to retry if the script fails (default: 1)
Cooldown (minutes)Minimum time between executions to prevent thrashing (default: 60)

Self-Healing Example

Automatically restart a critical service when it stops:

  1. Create a script named "Restart Service" with body: Restart-Service $env:ALERT_SERVICE_NAME -Force
  2. Configure a watched service for the service you want to monitor
  3. Create an alert rule for category service, condition equals, threshold 0 (stopped)
  4. Create an event trigger: category service, script "Restart Service", cooldown 10 minutes

Now when the service stops, the alert fires, the trigger runs the restart script, and the service recovers automatically.

Workflows

Workflows chain multiple actions together into a visual multi-step automation. Each workflow consists of:

  • Trigger — What starts the workflow (an event, a schedule, or manual execution)
  • Nodes — Individual steps: run a script, send a notification, create a ticket, wait, branch on condition
  • Edges — Connections between nodes defining the execution flow

Example Workflow: Disk Cleanup

  1. Trigger: Alert fires for disk below 10%
  2. Step 1: Run "Clear Temp Files" script
  3. Step 2: Wait 5 minutes, re-check disk
  4. Step 3: If disk still below 15%, create a ticket for manual review
  5. Step 4: Send Slack notification with the result

Script Execution History

Every script execution is logged with:

  • Agent hostname and ID
  • Script name and version
  • Start and end timestamps
  • Exit code
  • Standard output and error output
  • Who or what triggered the execution (manual, schedule, or event trigger)

View execution history under Automation → History or in the agent detail panel.