Scripting & Automation
Integrate BackupEngine into RMM tools, CI/CD pipelines, and custom scripts with PowerShell and bash.
RMM Integration
BackupEngine integrates with Remote Monitoring and Management (RMM) tools used by MSPs and IT teams. Deploy the agent silently, configure backup sets, and monitor status across your managed fleet.
Silent install and configure (PowerShell)
# Silent install with device key
$installerUrl = "https://download.backupengine.com/latest/BackupEngine-Setup.exe"
Invoke-WebRequest -Uri $installerUrl -OutFile "$env:TEMP\BackupEngine-Setup.exe"
Start-Process "$env:TEMP\BackupEngine-Setup.exe" -ArgumentList "/S /DEVICEKEY=$env:BE_DEVICE_KEY" -Wait
# Configure default backup set
backupengine auth login --device-key $env:BE_DEVICE_KEY
backupengine backup-set create --name "Client Data" --include "C:\Users" --exclude "*.tmp" --exclude "AppData\Local\Temp"
backupengine schedule set "Client Data" --type daily --time 02:00
# Verify installation
$status = backupengine agent status --json | ConvertFrom-Json
if ($status.agent.connected) {
Write-Host "BackupEngine installed and connected successfully"
}- •ConnectWise Automate: Deploy via script, monitor with custom monitors using JSON output.
- •Datto RMM: Use the component store or deploy a custom PowerShell script component.
- •NinjaRMM: Deploy as a scripted installation with the device key passed as a variable.
- •All RMM integrations use device API keys for authentication — no interactive MFA required after initial setup.
CI/CD Pipeline Integration
Use BackupEngine in CI/CD pipelines to back up build artifacts, database snapshots, or configuration files as part of your deployment process.
GitHub Actions example
# .github/workflows/backup.yml
name: Backup Database Before Deploy
on:
workflow_dispatch:
push:
branches: [main]
jobs:
backup:
runs-on: ubuntu-latest
steps:
- name: Install BackupEngine CLI
run: |
curl -fsSL https://download.backupengine.com/install.sh | bash
- name: Authenticate
run: |
backupengine auth login --device-key ${{ secrets.BE_DEVICE_KEY }}
- name: Run database backup
run: |
backupengine backup start "Production DB" --wait
STATUS=$(backupengine backup status "Production DB" --json | jq -r '.status')
if [ "$STATUS" != "completed" ]; then
echo "Backup failed with status: $STATUS"
exit 1
fi
- name: Deploy application
run: |
# Your deployment steps here
echo "Deploying after successful backup..."PowerShell Scripts
PowerShell is the recommended scripting language on Windows. BackupEngine's --json flag works seamlessly with ConvertFrom-Json for structured data processing.
Monitor backup health (PowerShell)
# Get status of all backup sets and alert on failures
$sets = backupengine backup-set list --json | ConvertFrom-Json
foreach ($set in $sets.backup_sets) {
$history = backupengine backup history $set.name --json --limit 1 | ConvertFrom-Json
$lastRun = $history.runs[0]
if ($lastRun.status -eq "failed") {
$subject = "BackupEngine Alert: $($set.name) failed on $env:COMPUTERNAME"
$body = "Backup set '$($set.name)' failed at $($lastRun.end_time). Error: $($lastRun.error)"
Send-MailMessage -To "admin@company.com" -From "backup@company.com" \
-Subject $subject -Body $body -SmtpServer "smtp.company.com"
}
}Bash Scripts
On macOS and Linux, use bash scripts with jq for JSON parsing. The CLI works identically across platforms.
Pre-backup database dump (bash)
#!/bin/bash
set -euo pipefail
# Dump database before file backup
echo "Dumping PostgreSQL database..."
pg_dump -h localhost -U app_user -d production > /backup/staging/db_dump.sql
# Run the backup set that includes the dump directory
echo "Starting backup..."
backupengine backup start "Server Data" --wait
# Check result
STATUS=$(backupengine backup status "Server Data" --json | jq -r '.status')
if [ "$STATUS" = "completed" ]; then
echo "Backup completed successfully"
UPLOADED=$(backupengine backup status "Server Data" --json | jq -r '.bytes_uploaded')
echo "Uploaded: $UPLOADED bytes"
else
echo "Backup failed!"
backupengine agent logs --tail 20
exit 1
fi💡 Tip
Use the --wait flag with backupengine backup start to make the command block until the backup completes. Without --wait, the command returns immediately and the backup runs in the background.