A Datto RMM Component to resolve Open Alerts via the RMM API.
This Component compliments existing Alert Resolution options in RMM, offering more flexibility and control over Alert Resolution, especially for 100s and 1000s of Open Alerts.
- Valid RMM API token, saved on target device as
$Env:RMMAPIKey, see RMM API docs - Preconfigured Environment Variables
- Download
resolve-open-alerts-v2.cpt - Import component in RMM, select
resolve-open-alerts-v2.cptand save
- In RMM, Activate the API
- Save the
API Key,API Secret KeyandAPI URLin a text file - Download RMM API example files and extract
powershell_token.ps1 - Open
Powershell ISEasAdministratorand open scriptpowershell_token.ps1 - Scroll to the bottom of
powershell_token.ps1, add code below and run script
For options outside Powershell, use
curl_token.batorcsharp_token.cs
# Define parameters
$params = @{
apiUrl = '[API URL]'
apiKey = '[API Key]'
apiSecretKey = '[API Secret Key]'
}
# Call New-AemApiAccessToken function using defined parameters
$key = New-AemApiAccessToken @params
# Save API Token as System Variable
[Environment]::SetEnvironmentVariable('RMMAPIKey',$key,'Machine')Requires process refresh for changes, close and reopen
Powershell ISE, then run below command to confirm token saved as System variable
[Environment]::GetEnvironmentVariable('RMMAPIKey', 'Machine')If token is not displayed, try saving again by rerunning
Powershell ISEas AdministratorRMM API token is not suitable as RMM Site Variable due to its character length exceeding limit.
- Use a Quick Job or Job Scheduler and select the target device
If running in production (e.g. from RMM), you only need to configure $Env:RMMAPIKey at System level, see Deployment.
Other variables required at deployment time, must be set manually in Invoke-MockComponent for local development and mock testing.
$Env:CS_WS_ADDRESS- preconfigured in RMM {merlot-centrastage.net|concord-centrastage.net| etc}$Env:Target{site|account}, default is site of device running component$Env:SiteID, set here if$Env:Target="site"$Env:Priority{All|Information|Low|Moderate|High|Critical}$Env:MonitorType, use Monitor Class names$Env:DeviceType{Desktop|Laptop|Server|ESXI Host|Printer|Network Device}$Env:UdfNumber{1-30}, UDF must be set to"resolvealerts"in RMM, see image below
See variables in Powershell and variables in RMM.
The quickest way to try out this component is by running in Powershell.
- Clone or Download source code
- Unzip to a suitable path
- Open
ResolveOpenAlerts.ps1in Visual Studio Code, Powershell ISE or your favourite Powershell IDE. - Define environment variables in
Invoke-MockComponentfor testing or just aboveInvoke-RMMComponentfor production/live - For testing, switch to development mode, see Running Tests
- Run script
The default RMM script timeout of 1 hour should resolve max 30,000 Alerts.
Requires environment variables.
Unit Tests have not been written for any functions yet, but Invoke-MockComponent can be used for local development, Integration Testing and/or Stress Testing. Just uncomment invocation at bottom of file, see snippet below.
#Invoke-MockComponent
Invoke-RMMComponentInvoke-MockComponent
#Invoke-RMMComponentWhen using
Invoke-MockComponent, Alerts are never resolved. Alert Resolution is simulated by using already Resolved Alerts as mock data.
For actual Alert Resolution in local development, use Invoke-RMMComponent directly with environment variables.
Anyone can contribute.
- Open a new issue to request bug fixes, features or a simple question
- Create a pull request to submit your own fixes, unit tests, features, or for typos and document updates
- Submit test cases

