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:
- Enter a name and optional description
- Select the language (powershell, batch, or python)
- Write or paste the script body
- 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:
- Go to Agents → select the agent → Commands
- Choose "Run Script" and select the script from your library
- 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 |
|---|---|
| Name | Descriptive name (e.g., "Weekly Disk Cleanup") |
| Script | Select from your script library |
| Cron | Cron expression for the schedule (e.g., 0 2 * * 0 for every Sunday at 2 AM) |
| Agent Filter | Optional filter to target specific agents (by tag, hostname pattern, or group) |
| Enabled | Toggle the schedule on or off |
Cron Expression Examples
| Expression | Schedule |
|---|---|
0 2 * * * | Every day at 2:00 AM |
0 2 * * 0 | Every Sunday at 2:00 AM |
0 */4 * * * | Every 4 hours |
0 9 * * 1-5 | Weekdays 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 |
|---|---|
| Name | Descriptive name (e.g., "Restart Print Spooler on Service Alert") |
| Alert Category | Which alert category triggers this (cpu, ram, disk, av, service, offline) |
| Alert Severity | Optional severity filter (only trigger on warning or critical alerts) |
| Script | Script to execute when the trigger fires |
| Max Retries | How 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:
- Create a script named "Restart Service" with body:
Restart-Service $env:ALERT_SERVICE_NAME -Force - Configure a watched service for the service you want to monitor
- Create an alert rule for category
service, conditionequals, threshold0(stopped) - 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
- Trigger: Alert fires for disk below 10%
- Step 1: Run "Clear Temp Files" script
- Step 2: Wait 5 minutes, re-check disk
- Step 3: If disk still below 15%, create a ticket for manual review
- 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.