The DattoRmmApi module was built to make the Datto RMM API readily accessible. These cmdlets let you hit every possible endpoint with every possible method without having to worry about scripting REST commands, handling paginations, detecting throttling, or anything else that might be standing between you and exploiting this great resource.
Make sure you have set up an API key for your user account in datto and know what your platform is (see here for instructions).
Install and import the PowerShell module from the PowerShell gallery with the commands
Install-Module DattoRmmApi
Import-Module DattoRmmApiNow any time you want to use the API, first run the command
Start-RmmApiSession -platform '<your platform>' -accessKey '<your access key>' -secretKey '<your secret key>'which will look something like
Start-RmmApiSession -platform zinfandel -accessKey 0123456789ABCDEFGHIJKLMNOPQRSTUV -secretKey ABCDEFGHIJKLMNOPQRSTUVWXYZ012345And you are off!
You can test things out by running
Get-RmmAccountDataCheck out the REST API explorer for the structure, and go to our documentation for usage details. You can also use the Get-Help cmdlet in PowerShell to get details about any cmdlet:
Get-Help Get-RmmAccountDataClick to list all of the cmdlets
- Get-RmmAccountData
- Get-RmmAccountVariables
- Get-RmmComponents
- Get-RmmDevices
- Get-RmmOpenAlerts
- Get-RmmResolvedAlerts
- Get-RmmSites
- Get-RmmUsers
- New-RmmAccountVariable
- Remove-RmmAccountVariable
- Set-RmmAccountVariable
- Get-RmmDeviceAuditData
- Get-RmmDeviceSoftwareAuditData
- Get-RmmEsxiHostAuditData
- Get-RmmPrinterAuditData
- Store your platform, access key, and masked secret key as account variables so you can use the API from within Datto components.
- Monitors in Datto RMM cannot interact with UDFs in real-time - unless you use the API! To get a UDF for the device a component is running on:
Start-RmmApiSession -platform $env:dattoRmmApiPlatform -accessKey $env:dattoRmmApiAccessKey -secretKey $env:dattoRmmApiSecretKey
Get-RmmDeviceUdf -deviceUid (Get-ItemProperty -Path 'HKLM:\SOFTWARE\CentraStage' -Name DeviceId).DeviceId -udf11and to set it:
Start-RmmApiSession -platform $env:dattoRmmApiPlatform -accessKey $env:dattoRmmApiAccessKey -secretKey $env:dattoRmmApiSecretKey
Set-RmmDeviceUdf -deviceUid (Get-ItemProperty -Path 'HKLM:\SOFTWARE\CentraStage' -Name DeviceId).DeviceId -udf11 "Hello World!"- At one point I found that there were a lot of alerts from back when Datto let us mute them that had become very stale. They pre-dated our integration with Connectwise Manage, and the API made it easy to find and resolve them:
$openAlerts = Get-RmmOpenAlerts
foreach ( $openAlert in $openAlerts ) {
if ( $openAlert.ticketNumber -eq $null -and $openAlert.muted -eq 'True' ) {
Set-DeviceOpenAlertResolved -alertUid $openAlert.alertUid
}
}- Our password management system has an API, and that lets us programmatically sync passwords from our manager to masked site variables in Datto - no more double hop issues!
- 1.1.0
- Fixed issue with New-RmmDeviceQuickJob
- Added debug code to New-RmmApiRequest
- 1.0.1
- Improved documentation
- 1.0.0
- Initial version