Skip to main content

Datto RMM

This is a how-to for RMM mass-deploy on Datto RMM.

One component covers the fleet. Datto RMM runs it as LocalSystem. The script reads the site id, the site name, and a registration token from Datto variables.

Every method still needs a verified installer and the right deployment scope.

How the script knows which SparkLogs organization a device belongs to​

Datto RMM groups devices as account, then site, then device. A site is the usual stand-in for one client.

When a component runs, Datto RMM sets these environment variables for that run:

Datto RMM variableUse in SparkLogs
CS_PROFILE_UIDRMMCLIENTID (stable site id)
CS_PROFILE_NAMECLIENTNAME (display label only, not a link key)

CS_PROFILE_UID maps one Datto RMM site to one SparkLogs organization (for most MSPs, a client). A customer with several Datto RMM sites gets one SparkLogs organization per site. To land several sites in one SparkLogs organization, put the same id in a site variable and pass that as RMMCLIENTID or PSACLIENTID.

Where the registration token comes from​

Set a global variable named SPARKLOGS_REGISTRATION_TOKEN to the Clients registration token. On your own Datto RMM site, set a site variable with that same name to the Internal IT token. Datto RMM uses the site value on that site and the global value everywhere else. The name match is case-sensitive. Do not also add this name as a component input variable, or each job asks for a value.

If your own machines sit in more than one site, set the Internal IT token on each of those sites.

ValueWhere it lives
Clients registration tokenGlobal variable SPARKLOGS_REGISTRATION_TOKEN
Internal IT registration tokenSite variable SPARKLOGS_REGISTRATION_TOKEN on your own site
Site id and nameCS_PROFILE_UID and CS_PROFILE_NAME, set by Datto RMM

A masked variable is still written in clear text if extended component logging is on.

The script​

PowerShell, Windows, 64-bit, run as LocalSystem (the Datto RMM default). It exits when the SparkLogsAgent service is already installed, refuses to run without a site id or a token, verifies the download by SHA-256, and treats exit 0, 3010, and 1641 as success.

The URL and hash are the current published Windows x64 EXE (1.9.10). If your workspace release ring is not this build, take the URL and hash from the deploy wizard. This is a starting point to adapt, not a supported partner package.

$ErrorActionPreference = 'Stop'

if (Get-Service 'SparkLogsAgent' -ErrorAction SilentlyContinue) { exit 0 }

$RmmClientId = [string]$env:CS_PROFILE_UID
$ClientName = [string]$env:CS_PROFILE_NAME
$token = [string]$env:SPARKLOGS_REGISTRATION_TOKEN
if ([string]::IsNullOrWhiteSpace($RmmClientId)) {
throw 'CS_PROFILE_UID is empty. Run this component from Datto RMM.'
}
if ([string]::IsNullOrWhiteSpace($token)) {
throw 'SPARKLOGS_REGISTRATION_TOKEN is empty. Set the global variable, and the site override for your own site.'
}

$url = 'https://cdn.sparklogs.app/agent/data/1.9.10/windows_x86_64/sha256_1eccc34031cdab0b348027efa7515f7b643183320de86af46bac7b8598cb5804/SparkLogsAgentSetup-x64-1.9.10.exe'
$sha = '1eccc34031cdab0b348027efa7515f7b643183320de86af46bac7b8598cb5804'
$exe = Join-Path $env:TEMP 'SparkLogsAgentSetup.exe'

Invoke-WebRequest $url -OutFile $exe -UseBasicParsing
if ((Get-FileHash $exe -Algorithm SHA256).Hash -ne $sha) { throw 'SHA-256 mismatch' }

$installArgs = @(
'/qn', '/norestart',
'EULA=ACCEPT',
"REGISTRATION_TOKEN=$token",
"RMMCLIENTID=$RmmClientId",
"CLIENTNAME=`"$ClientName`""
)
$p = Start-Process $exe -Wait -PassThru -ArgumentList $installArgs
if ($p.ExitCode -notin 0, 3010, 1641) {
throw "Install failed with exit code $($p.ExitCode)"
}

Property names are RMMCLIENTID, CLIENTNAME, and PSACLIENTID. Start-Process -Wait -PassThru is what makes PowerShell wait for the installer. See Troubleshooting.

Add it in Datto RMM​

  1. Setup → Global Settings → Variables. Add SPARKLOGS_REGISTRATION_TOKEN and paste the Clients registration token.
  2. Open your own site, add a site variable with that same name, and paste the Internal IT registration token.
  3. Automation → Components. New component, category of your choice, script type PowerShell. Paste the script. Do not define SPARKLOGS_REGISTRATION_TOKEN in the component's Variables section.
  4. Save the component, then schedule a job that targets your Windows devices. Quick jobs and scheduled jobs run as LocalSystem.

Run it often on day one so offline machines get a later pass, then daily. The daily run finds machines that do not have the service yet. The agent updates itself after install, so this job does not need a new script when a new agent build ships. Replace the URL and hash in the script only if your release ring is not the build published above.

Pilot before the fleet install​

  1. Run it on one machine in your own Datto RMM site.
  2. Run it on one machine in one small client site.
  3. In SparkLogs, confirm the internal machine landed under Internal IT and the client machine under Clients, each in a child organization named for that Datto RMM site.

If a client machine landed under Internal IT, that site has the Internal IT token in its site variable. Clear that site variable so the site falls back to the global Clients token. Move the test machine with Change ownership on Configure > Agents. Installing again does not move it. See Moving devices and organizations.

Linking to SparkLogs organizations you already created​

SparkLogs auto-creates a direct child of the token's organization for each new RMMCLIENTID. If those organizations already exist, set each one's RMM client ID to the Datto RMM site UID (CS_PROFILE_UID) before you install, so the install links to it. SparkLogs links on RMMCLIENTID and/or PSACLIENTID.

CS_PROFILE_UID is the site id Datto RMM shows on the site and does not change when you rename the site. See Changing RMM or PSA platforms if you later key organizations to a different id.

After a rename or a move in Datto RMM​

The values on the next install decide the SparkLogs organization for a device's first enrollment.

  • Renaming a site changes CLIENTNAME on a new install. It does not rename an agent that is already enrolled.
  • Moving a device to another site does not move it in SparkLogs. Use Change ownership on Configure > Agents. See Moving devices and organizations.
  • Reinstalling with a different token does not move a device. It returns to the device record it already has.
  • A SparkLogs organization you deleted still matches during its archive window, and an install that resolves to it fails. Undelete it, or wait until it has cleared, before you reuse the site id.

Uninstalling from Datto RMM leaves SparkLogs enrollment state on disk. See Uninstall and reinstall.