Deploy the Dex Device Agent on Windows

Prev Next

DEVICE AGENT · DEPLOYMENT

5–30 min (by method)

3 phases · 6 steps (the step count shown on the page changes with the chosen method: 6 for Microsoft Intune and Group Policy, 5 for Manual and RMM, 4 for Other methods)

YOU'LL USE: Dex, Windows

Before you begin

  • Local Administrator rights on targets (or a management platform that runs as SYSTEM).
  • Windows 10 21H2 / Windows Server 2019 or later, x64.
  • Outbound HTTPS (TCP 443) from endpoints to https://dex365.ai and download.dex365.ai.
  • The tenant's enrollment token from the Dex admin portal.

Phase 1: Prepare Dex

Enable the Windows Device app, then generate an enrollment token. One tenant-agnostic MSI for every tenant. The token is always delivered separately.

Step 1: Enable the Windows Device app

1 min · In Dex

Dex only manages Windows endpoints when the Windows Device app is enabled in the App Store. Turn it on before enrolling devices. Otherwise the agent connects but Dex has no tools or skills to act on it.

  1. In the left menu, click App Store.
  2. Find the Windows Device app card ("Windows device management tools including diagnostics, PowerShell execution, and remote desktop control").
  3. Check the toggle in the top-right of the card. If it's off, click it to enable the app.
  4. A green/filled toggle means it's enabled and its Tools and Skills are available to Dex.

Configure app (optional) Configure app on the card opens the app's tools, skills, and autonomy settings. The defaults are fine to start. You can tune what Dex is allowed to do per tool later.

Step 2: Generate an enrollment token in Dex

2 min · In Dex

Sign in to the Dex management console, then go to Settings → Devices. Under Enrollment tokens, generate a new token (or reveal an existing one). This is the value you'll substitute for {{ENROLLMENT_TOKEN}} in every method below. The MSI itself is tenant-agnostic; the token is always delivered separately.

  1. Open the Dex management console at https://dex365.ai/client/ and sign in.
  2. In the left menu click Settings, then open the Devices tab.
  3. Under Enrollment tokens ("Tokens used by the device agent installer to enroll devices"), click Generate Token to create a new one, or reveal an existing token with the eye icon in the Token column.
  4. Optionally give the token a Name (e.g. "Intune auto-deployment") so you can identify it later, then copy the token value.
  5. The same panel has a Download Windows agent link (the MSI) and the Connected endpoints table, where devices show up as they enroll.

MSI DOWNLOAD URL

https://download.dex365.ai/windows/DexDeviceAgent.msi

REGISTRY POLICY KEY (TOKEN, OPTIONAL BASEURL / USERUPNOVERRIDE AS REG_SZ)

HKLM\SOFTWARE\Policies\DexDeviceAgent

How the token reaches each machine Three mechanisms: a registry policy value under HKLM\SOFTWARE\Policies\DexDeviceAgent (best for Intune / GPO / RMM: the agent re-reads it every ~30 seconds, so token rotation needs no reinstall), the CLI (DexDeviceAgent.exe --configure --token …, best for scripted installs), or the configurator GUI that opens after an interactive install. Pick the one that matches your method below.

The MSI takes no token properties msiexec does not accept ENROLLMENTTOKEN=, BASEURL=, or TENANTUUID= on the command line. Passing them does nothing. Configuration always happens via the registry policy, --configure, or the GUI.

Install order never matters If the MSI installs before a token is available, the service idles, logs "Waiting for enrollment configuration", and retries every 30 seconds until one appears.

Treat the token as a secret Prefer your platform's secret store (Intune script content, NinjaOne secure fields, Datto site variables) over hardcoding it in shared scripts. After enrollment the agent exchanges it for a per-device secret and never logs either. You can Revoke a token any time from the same list.

Phase 2: Deploy

Install the MSI and deliver the token with your chosen method.

HOW DO YOU WANT TO DEPLOY?

  • Manual, single machine (Pilot · ~5 min): One machine, interactively or from an elevated PowerShell. Best for pilots, VIP machines, and troubleshooting.
  • Microsoft Intune (Fleet · MDM): Win32 app that installs the MSI and writes the registry policy, for Entra ID joined devices.
  • Group Policy (AD) (Fleet · on-prem): MSI assignment plus a registry preference for on-prem Active Directory domains.
  • RMM platform (Fleet · fastest): NinjaOne, Datto RMM, Atera, ConnectWise, Kaseya (any tool that runs PowerShell as SYSTEM).
  • Other methods (SCCM · PDQ · images): SCCM/MECM, PDQ Deploy, remote PowerShell/WinRM, golden images and Autopilot.

The steps below change based on your choice. Both paths end at the same place.

Variant: Manual, single machine (Interactive GUI)

HOW ARE YOU INSTALLING? choices: "Interactive (GUI)" (Someone is at the keyboard) and "Headless (PowerShell)" (Elevated shell, recommended for scripting).

Step 3: Install and enroll the agent

~5 min · Now in Windows

Install on one machine: interactively with the GUI configurator, or headless from an elevated PowerShell.

  1. Download and double-click DexDeviceAgent.msi, then walk through the wizard.
  2. When the install finishes, the configurator opens automatically (DexAgentConfigurator.exe).
  3. Enter the Enrollment token; leave Cloud service URL at the default https://dex365.ai and User UPN override blank (the agent detects the logged-in user).
  4. Click Save and Enroll and accept the UAC prompt.
  5. The agent enrolls within ~30 seconds and the device appears in the Dex admin portal.

Configurator closed or didn't appear? Launch it from the Start menu: Start → Configure Dex Device Agent. If it still doesn't open, the install was silent or a token is already configured. Use --configure from an elevated shell instead.

Step 4: Reconfigure, upgrade, or uninstall (shared by both Manual sub-variants)

as needed · In Windows

Reconfigure an enrolled machine from the Start menu (Configure Dex Device Agent: it detects the existing enrollment and offers Reconfigure) or with an elevated --configure. To upgrade, run the new MSI the same way: it performs an in-place major upgrade that preserves enrollment and config.yaml. Uninstall via Settings → Apps → Dex Device Agent, or silently with the command below.

SILENT UNINSTALL (THE GUID IS THE UPGRADECODE, STABLE ACROSS VERSIONS)

msiexec /x "{6F8B2A5C-3A1F-4C7A-9E2D-1B4F8C7A9D3E}" /qn

Uninstall removes the device secret Both uninstall paths remove the service, all binaries, and C:\ProgramData\DexDeviceAgent\ including the device secret. The device must re-enroll if reinstalled.

Variant: Manual, single machine (Headless PowerShell)

Step 3: Install and enroll the agent

~5 min · Now in Windows

Install on one machine: interactively with the GUI configurator, or headless from an elevated PowerShell.

  1. Open PowerShell as Administrator.
  2. Run the script below. It downloads the MSI, installs silently, and delivers the token. Replace {{ENROLLMENT_TOKEN}} first.
  3. Optional --configure flags: --base-url "…" (non-default environments only) and --upn-override "user@domain.com" (report a fixed UPN). Running --configure with no flags starts an interactive prompt that keeps the token out of shell history.

INSTALL + CONFIGURE (RUN AS ADMINISTRATOR)

$ErrorActionPreference = 'Stop'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

# Download
$msi = Join-Path $env:TEMP 'DexDeviceAgent.msi'
Invoke-WebRequest -Uri 'https://download.dex365.ai/windows/DexDeviceAgent.msi' -OutFile $msi

# Silent install
$p = Start-Process msiexec.exe -Wait -PassThru -ArgumentList @(
    '/i', "`"$msi`"", '/qn', '/norestart', '/l*v', "`"$env:TEMP\DexDeviceAgent-install.log`""
)
if ($p.ExitCode -notin 0, 3010) { throw "MSI install failed: exit code $($p.ExitCode)" }

# Configure (headless equivalent of the GUI configurator)
& 'C:\Program Files\DexDeviceAgent\DexDeviceAgent.exe' --configure --token '{{ENROLLMENT_TOKEN}}'

"Access is denied" on install or configure The shell isn't elevated. Open PowerShell as Administrator and re-run. Elevation is required for both the MSI and --configure.

Step 4: Reconfigure, upgrade, or uninstall

Identical to Step 4 under "Variant: Manual, single machine (Interactive GUI)" above (same text and silent uninstall command, as rendered on the page for both sub-variants).

Variant: Microsoft Intune

Step 3: Build the Win32 package

~10 min · Now in Windows

One self-contained Win32 app installs the MSI and writes the registry policy, with proper detection and retry semantics. On any workstation, create a folder with the two scripts below, then wrap it with the Microsoft Win32 Content Prep Tool.

  1. Create a folder (e.g. DexAgentPackage) containing Install-DexAgent.ps1 and Uninstall-DexAgent.ps1. Contents below.
  2. Replace {{ENROLLMENT_TOKEN}} in Install-DexAgent.ps1 with the tenant's token.
  3. Wrap the folder: IntuneWinAppUtil.exe -c .\DexAgentPackage -s Install-DexAgent.ps1 -o .\out

INSTALL-DEXAGENT.PS1

$ErrorActionPreference = 'Stop'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

# Deliver tenant config via registry policy (read by the agent every ~30 s)
New-Item -Path 'HKLM:\SOFTWARE\Policies\DexDeviceAgent' -Force | Out-Null
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\DexDeviceAgent' `
                 -Name 'EnrollmentToken' -Value '{{ENROLLMENT_TOKEN}}'
# Optional — only for non-default environments:
# Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\DexDeviceAgent' -Name 'BaseURL' -Value '{{BASE_URL}}'

# Download and install the tenant-agnostic MSI
$msi = Join-Path $env:TEMP 'DexDeviceAgent.msi'
Invoke-WebRequest -Uri 'https://download.dex365.ai/windows/DexDeviceAgent.msi' -OutFile $msi
$p = Start-Process msiexec.exe -Wait -PassThru -ArgumentList @(
    '/i', "`"$msi`"", '/qn', '/norestart', '/l*v', "`"$env:TEMP\DexDeviceAgent-install.log`""
)
if ($p.ExitCode -notin 0, 3010) { exit $p.ExitCode }
exit 0

UNINSTALL-DEXAGENT.PS1

Start-Process msiexec.exe -Wait -ArgumentList '/x "{6F8B2A5C-3A1F-4C7A-9E2D-1B4F8C7A9D3E}" /qn /norestart'
Remove-Item -Path 'HKLM:\SOFTWARE\Policies\DexDeviceAgent' -Recurse -Force -ErrorAction SilentlyContinue

WRAP THE PACKAGE

IntuneWinAppUtil.exe -c .\DexAgentPackage -s Install-DexAgent.ps1 -o .\out

Bundle the MSI to avoid a download dependency Include DexDeviceAgent.msi in the folder instead of downloading at install time: drop the Invoke-WebRequest lines and point msiexec at "$PSScriptRoot\DexDeviceAgent.msi". This removes the dependency on outbound access to download.dex365.ai during install.

Simpler alternative: LOB MSI + platform script Upload the MSI as a Line-of-business app (Intune installs LOB MSIs silently in system context; the MSI takes no arguments) and add a Platform script that writes the EnrollmentToken registry value (run using logged-on credentials: No; 64-bit PowerShell host: Yes). Two Intune objects instead of one. Order doesn't matter, whichever lands second completes enrollment within ~30 s.

Step 4: Create the Win32 app in Intune

~5 min · In Windows

In the Intune admin center, go to Apps → Windows → Add → Windows app (Win32) and upload the .intunewin file, then configure it as follows.

  1. Install command: the sysnative PowerShell command below: sysnative forces 64-bit PowerShell so the registry write lands in the 64-bit hive, not WOW6432Node.
  2. Uninstall command: the same path with Uninstall-DexAgent.ps1.
  3. Install behavior: System. Device restart behavior: No specific action.
  4. Requirements: x64; minimum OS Windows 10 21H2.
  5. Detection rule → Manually configure → File: path C:\Program Files\DexDeviceAgent, file DexDeviceAgent.exe, method "File or folder exists".

INSTALL COMMAND

%SystemRoot%\Sysnative\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -NoProfile -File Install-DexAgent.ps1

UNINSTALL COMMAND

%SystemRoot%\Sysnative\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -NoProfile -File Uninstall-DexAgent.ps1

Step 5: Assign, pilot, and roll out

~5 min + check-in · In Windows

Assign the app as Required to a device group, not a user group, since the agent is a machine-wide service. Pilot on a small group first, then broaden.

  1. Assign as Required to a pilot device group.
  2. Deployment lands at the next Intune Management Extension check-in, typically within 1 hour, up to 8 for offline devices.
  3. Verify on a pilot device (next phase), then widen the assignment.

Token rotation Push a new EnrollmentToken value (update the package and re-deploy, or use a remediation). Already-enrolled devices ignore it: they hold a device_secret; not-yet-enrolled devices pick it up within ~30 s. No reinstall is ever needed.

App shows Failed in Intune? Check the IME log C:\ProgramData\Microsoft\IntuneManagementExtension\Logs\IntuneManagementExtension.log and the MSI log C:\Windows\Temp\DexDeviceAgent-install.log (SYSTEM's temp). If the registry value sits under WOW6432Node, the script ran in 32-bit PowerShell. Use the sysnative path.

Variant: Group Policy (AD)

Step 3: Stage the MSI on a network share

~5 min · Now in Windows

Download the MSI and place it on a UNC path readable by machine accounts: assigned packages are fetched at boot by the computer account, not the user.

  1. Place the MSI on a UNC path, e.g. \fileserver\software\Dex\DexDeviceAgent.msi.
  2. Grant Read on both the share and NTFS permissions to Domain Computers.
  3. Test from a target machine: Test-Path '\fileserver\software\Dex\DexDeviceAgent.msi'.

Step 4: Create the GPO (MSI assignment + token)

~10 min · In Windows

One GPO carries both pieces: a Software Installation package that assigns the MSI to computers, and a Registry preference that delivers the enrollment token. The agent re-reads the registry every ~30 seconds, so it doesn't matter which piece applies first.

  1. In Group Policy Management, create a GPO (e.g. "Dex Device Agent") and edit it.
  2. Software installation: Computer Configuration → Policies → Software Settings → Software installation → New → Package → enter the UNC path (not a local path) → choose Assigned.
  3. Registry preference: Computer Configuration → Preferences → Windows Settings → Registry → New → Registry Item. Action: Update, Hive: HKEY_LOCAL_MACHINE, Key path: SOFTWARE\Policies\DexDeviceAgent, Value name: EnrollmentToken, Value type: REG_SZ, Value data: the tenant token.
  4. Add further Registry Items only if needed: BaseURL (non-default environments) and UserUPNOverride (fixed UPN reporting).

Assigned packages install at boot Assigned computer packages install at boot, before logon: silent, no user interaction, and no token properties needed (the MSI accepts none).

Anyone who can read the GPO can read the token Scope GPO read permissions accordingly, and rotate the token per your policy. Pushing a new value propagates to running agents within ~30 s with no reinstall. Alternatively deliver the token via your RMM and use GPO only for the MSI.

one reboot cycle · In Windows

Link the GPO to a pilot OU with one or two machines first. Software Installation only applies at boot, so force policy and reboot the pilot machine. After verifying, link to the production OUs. Fleet-wide convergence takes one reboot cycle per machine, typically 24–48 hours.

  1. Link the GPO to a pilot OU.
  2. On a pilot machine run gpupdate /force, then reboot.
  3. Verify (next phase): gpresult /h report.html confirms both the package and the registry preference applied.
  4. Link the GPO to the production OUs.

FORCE POLICY + REBOOT ON A PILOT MACHINE

gpupdate /force
shutdown /r /t 0

Upgrades Stage the new MSI on the share, add it as a new package, and on its Upgrades tab add the existing package. No uninstall-then-install needed. The MSI does an in-place major upgrade preserving enrollment. Machines upgrade at next boot.

Prefer a startup script? Use Computer Configuration → Policies → Windows Settings → Scripts → Startup with the universal install script from the RMM path. It's idempotent, so safe at every boot. It needs outbound HTTPS to download.dex365.ai from machine context.

MSI never installs? The machine can't read the share as its computer account. Check Event Viewer → Application → MsiInstaller and System → Application Management Group Policy; %%1612 source errors mean the UNC path or share permissions are wrong.

Variant: RMM platform

Step 3: Create the universal deployment script

~5 min · Now in Windows

Any RMM that runs a PowerShell script as SYSTEM can deploy the agent. The universal script below is idempotent (safe to run repeatedly or attach to a recurring policy): it exits fast when the agent is already configured, installs and delivers the token via registry policy otherwise, then waits up to 3 minutes for enrollment.

UNIVERSAL DEPLOYMENT SCRIPT (POWERSHELL, RUNS AS SYSTEM)

$ErrorActionPreference = 'Stop'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

$token = '{{ENROLLMENT_TOKEN}}'        # or read from an RMM-injected variable (next step)
$exe   = 'C:\Program Files\DexDeviceAgent\DexDeviceAgent.exe'

# Idempotency: nothing to do if installed and configured
if (Test-Path $exe) {
    & $exe --has-config
    if ($LASTEXITCODE -eq 0) { Write-Output 'Dex agent already installed and configured.'; exit 0 }
}

# Download + silent install
$msi = Join-Path $env:TEMP 'DexDeviceAgent.msi'
Invoke-WebRequest -Uri 'https://download.dex365.ai/windows/DexDeviceAgent.msi' -OutFile $msi
$p = Start-Process msiexec.exe -Wait -PassThru -ArgumentList @(
    '/i', "`"$msi`"", '/qn', '/norestart', '/l*v', "`"$env:TEMP\DexDeviceAgent-install.log`""
)
if ($p.ExitCode -notin 0, 3010) { Write-Error "MSI install failed: $($p.ExitCode)"; exit 1 }

# Deliver the token via registry policy (avoids the token in any process command line)
New-Item -Path 'HKLM:\SOFTWARE\Policies\DexDeviceAgent' -Force | Out-Null
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\DexDeviceAgent' -Name 'EnrollmentToken' -Value $token
# Optional: Set-ItemProperty ... -Name 'BaseURL' -Value '{{BASE_URL}}'   # non-default environments only

# Wait for enrollment (agent polls config every ~30 s)
$deadline = (Get-Date).AddMinutes(3)
do {
    Start-Sleep -Seconds 10
    $enrolled = Select-String -Path 'C:\ProgramData\DexDeviceAgent\config.yaml' `
                              -Pattern 'device_secret:\s*"?\S' -Quiet -ErrorAction SilentlyContinue
} until ($enrolled -or (Get-Date) -gt $deadline)

if ($enrolled) { Write-Output 'Dex agent installed and enrolled.'; exit 0 }
Write-Output 'Installed; enrollment still pending — check token validity and network.'
Get-Content C:\ProgramData\DexDeviceAgent\logs\*.log -Tail 20
exit 1

REMOVAL SCRIPT (FOR OFFBOARDING POLICIES)

Start-Process msiexec.exe -Wait -ArgumentList '/x "{6F8B2A5C-3A1F-4C7A-9E2D-1B4F8C7A9D3E}" /qn /norestart'
Remove-Item -Path 'HKLM:\SOFTWARE\Policies\DexDeviceAgent' -Recurse -Force -ErrorAction SilentlyContinue

Recurring policy is the best delivery Attach the script to an "every N hours / on new device" policy. It exits fast when already configured, giving automatic coverage and self-healing for new endpoints.

Run as SYSTEM The MSI install and the HKLM registry write both require SYSTEM (or elevated admin). For MSPs: store one enrollment token per customer/site in the platform's scoped variable store. Never hardcode a token in a script shared across customers.

Step 4: Wire it into your RMM and deploy

~10 min · In Windows

Only the token-injection line changes per platform: store the token in the platform's secure variable store and read it in the script.

WHICH RMM? choices: NinjaOne (Secure global custom field + automation script), Datto RMM (Masked site variable + component), Another RMM (Atera, ConnectWise, Kaseya, Action1, …).

Sub-variant: RMM platform > NinjaOne

  1. Store the token: Administration → Devices → Global Custom Fields → create dexEnrollmentToken (type Secure, script read access enabled). Set its value per-organization so MSP tenants get their own token.
  2. Create the script: Administration → Library → Automation → Add → New Script (Language PowerShell, OS Windows, run as System). Paste the universal script and replace the $token line with the snippet below.
  3. Deploy: run on demand against a device/group, or attach to a Policy → Scheduled Scripts so new endpoints get it automatically.
  4. Monitor: the script activity log shows the final status line; add a condition on Windows service DexDeviceAgent (state ≠ Running) for ongoing health.

REPLACE THE $TOKEN LINE WITH

$token = Ninja-Property-Get dexEnrollmentToken
if ([string]::IsNullOrWhiteSpace($token)) { Write-Error 'dexEnrollmentToken custom field not set'; exit 1 }

Sub-variant: RMM platform > Datto RMM

  1. Store the token: Sites → (site) → Settings → Variables → add DexEnrollmentToken (masked). Site variables are injected into component shells as environment variables: per-site values support MSP multi-tenant rollouts.
  2. Create a component: Components → New Component → Script (category Applications, script type PowerShell, run as Local System). Paste the universal script and replace the $token line with the snippet below.
  3. Optionally attach DexDeviceAgent.msi to the component instead of downloading. Attached files land in the working directory, so use $msi = Join-Path $PWD 'DexDeviceAgent.msi' and drop the Invoke-WebRequest.
  4. Deploy: run as a Quick Job for ad-hoc installs, or schedule it in a Policy targeting the site/filter. Monitor job stdout and add a Service monitor for DexDeviceAgent.

REPLACE THE $TOKEN LINE WITH

$token = $env:DexEnrollmentToken
if ([string]::IsNullOrWhiteSpace($token)) { Write-Error 'DexEnrollmentToken site variable not set'; exit 1 }

Sub-variant: RMM platform > Another RMM (Atera, ConnectWise, Kaseya, Action1, …)

  1. Atera: Scripts library, run as System; token in a script variable / per-customer threshold profile value.
  2. ConnectWise Automate: script with a PowerShell step run elevated; token in a client-level EDF. ConnectWise RMM: PowerShell task in System context; site-level custom field.
  3. Kaseya VSA: Agent Procedure → Execute PowerShell (System); token in a managed variable / custom field per org.
  4. Action1: script library or "Run Script" in System context; token as a script parameter per endpoint group.
  5. Level, Syncro, Pulseway, etc.: PowerShell automation as System; token in the platform's per-customer variable/secret store.

The same rules hold everywhere Run as SYSTEM; one token per customer/site; attach the script to a recurring policy for self-healing coverage. The one-line health check is "C:\Program Files\DexDeviceAgent\DexDeviceAgent.exe" --has-config (exit 0 = configured).

Variant: Other methods

Step 3: Deploy through your channel

varies · Now in Windows

Every method reduces to the same two steps: install the tenant-agnostic MSI silently, then deliver the enrollment token (registry policy or --configure). Private winget/Chocolatey feeds work the same way: thin wrappers over the MSI with /qn and the registry token write in the install script.

WHICH CHANNEL? choices: SCCM / MECM (Configuration Manager application), PDQ Deploy (Two-step package), Remote PowerShell (Ad-hoc over WinRM, no platform), Golden image / Autopilot (VDI, templates, zero-touch).

Sub-variant: Other methods > SCCM / MECM

  1. Create an Application with deployment type Windows Installer (.msi) pointing at DexDeviceAgent.msi on your content source. Install program: msiexec /i DexDeviceAgent.msi /qn /norestart; uninstall: msiexec /x "{6F8B2A5C-3A1F-4C7A-9E2D-1B4F8C7A9D3E}" /qn. Detection: MSI product code, or the file C:\Program Files\DexDeviceAgent\DexDeviceAgent.exe.
  2. Deliver the token with a Configuration Item / Baseline (remediation script writing HKLM\SOFTWARE\Policies\DexDeviceAgent\EnrollmentToken) or a second script deployment type. Order doesn't matter: the agent polls every ~30 s.
  3. Deploy to a device collection; pilot first.
  4. Alternatively, use a Script deployment type running the universal RMM script as a single self-contained unit.

TOKEN REMEDIATION SCRIPT

New-Item -Path 'HKLM:\SOFTWARE\Policies\DexDeviceAgent' -Force | Out-Null
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\DexDeviceAgent' `
                 -Name 'EnrollmentToken' -Value '{{ENROLLMENT_TOKEN}}'

Sub-variant: Other methods > PDQ Deploy

  1. Create a package with an Install step: DexDeviceAgent.msi with parameters /qn /norestart (PDQ runs as SYSTEM/Deploy User).
  2. Add a PowerShell step that writes the registry token: snippet below.
  3. Target a PDQ Inventory collection (e.g. "machines missing service DexDeviceAgent") for automatic gap-filling.

POWERSHELL STEP (TOKEN)

New-Item -Path 'HKLM:\SOFTWARE\Policies\DexDeviceAgent' -Force | Out-Null
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\DexDeviceAgent' `
                 -Name 'EnrollmentToken' -Value '{{ENROLLMENT_TOKEN}}'

Sub-variant: Other methods > Remote PowerShell

  1. For a handful of machines reachable over WinRM, run the script below from an admin workstation. It prompts for the token (kept out of shell history), then installs and configures each target.
  2. The same script body works over psexec -s where WinRM is unavailable.

BULK INSTALL OVER WINRM

$targets = 'PC-001','PC-002','PC-003'
$token   = Read-Host -AsSecureString 'Enrollment token'   # avoid plaintext in history
$plain   = [Runtime.InteropServices.Marshal]::PtrToStringAuto(
           [Runtime.InteropServices.Marshal]::SecureStringToBSTR($token))

Invoke-Command -ComputerName $targets -ArgumentList $plain -ScriptBlock {
    param($tok)
    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    $msi = Join-Path $env:TEMP 'DexDeviceAgent.msi'
    Invoke-WebRequest -Uri 'https://download.dex365.ai/windows/DexDeviceAgent.msi' -OutFile $msi
    $p = Start-Process msiexec.exe -Wait -PassThru -ArgumentList "/i `"$msi`" /qn /norestart"
    if ($p.ExitCode -notin 0,3010) { throw "$env:COMPUTERNAME MSI failed: $($p.ExitCode)" }
    New-Item -Path 'HKLM:\SOFTWARE\Policies\DexDeviceAgent' -Force | Out-Null
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\DexDeviceAgent' -Name 'EnrollmentToken' -Value $tok
    "$env:COMPUTERNAME ok"
}

Sub-variant: Other methods > Golden image / Autopilot

  1. In the reference image: install the MSI silently, and nothing else. Do not run --configure, and ensure C:\ProgramData\DexDeviceAgent\config.yaml has no enrollment_token or device_secret: a baked secret would make every clone identify as the same device.
  2. At first boot of each clone, deliver the token via whichever channel manages the machine: Intune / GPO / RMM registry policy, or a first-boot script. Until the token arrives the service idles, retrying every 30 s, by design.
  3. Autopilot: nothing special. Let the Intune assignment install the agent during or after ESP. Marking the Win32 app required for ESP is optional; the agent doesn't block user productivity.

Clone detection The agent generates a unique instance_id per installation on first run (cloned-VM detection), but enrollment identity must still come from a post-clone token delivery.

Phase 3: Verify

Confirm the service is running, configured, and enrolled.

Step 6: Verify the deployment

(numbered Step 6 on the Microsoft Intune and Group Policy variants, Step 5 on Manual and RMM, and Step 4 on Other methods) ~2 min · In Windows

Use these deterministic checks after any method. The end-to-end confirmation is the device appearing in the Dex admin portal within a minute of enrollment.

  1. Service running: (Get-Service DexDeviceAgent).Status returns Running.
  2. Configured: DexDeviceAgent.exe --has-config exits 0.
  3. Enrolled: config.yaml contains a device_secret. The token is exchanged within ~30 s of enrollment.
  4. The device appears in the Dex admin portal.

VERIFICATION COMMANDS (POWERSHELL)

# 1. Installed: binary present
Test-Path 'C:\Program Files\DexDeviceAgent\DexDeviceAgent.exe'        # True

# 2. Service running
(Get-Service DexDeviceAgent).Status                                    # Running

# 3. Configured: exit code 0 iff an enrollment token or device secret exists
& 'C:\Program Files\DexDeviceAgent\DexDeviceAgent.exe' --has-config; $LASTEXITCODE   # 0

# 4. Enrolled: after successful enrollment the token is exchanged for a
#    device_secret in config.yaml (enrollment completes within ~30 s)
Select-String -Path 'C:\ProgramData\DexDeviceAgent\config.yaml' `
              -Pattern 'device_secret:\s*"?\S' -Quiet                  # True

# 5. Recent logs, if anything above failed
Get-Content C:\ProgramData\DexDeviceAgent\logs\*.log -Tail 50

"Waiting for enrollment configuration" in the log No token has reached the machine. Check the registry policy landed (reg query HKLM\SOFTWARE\Policies\DexDeviceAgent: a value under WOW6432Node means a 32-bit script wrote it), or run --configure --token … from an elevated shell.

Enrollment 401/403 in the log Wrong or expired token. Get a fresh one from the Dex admin portal, then rotate the registry value or re-run --configure.

Service stopped or flapping Read C:\ProgramData\DexDeviceAgent\logs*.log (usually a proxy/firewall blocking outbound HTTPS 443 to the base URL).

Devices enrolled and reporting

The agent is installed and enrolled, and your Windows devices show up in the Dex admin portal. Dex can now run diagnostics and remediations on them. Roll the same method out to the rest of the fleet, or set up your Macs next.