Migrating from another MDM

The guide provides detailed steps for migrating devices from Intune to another MDM, including script uploads, policy creation, and linking automation for a seamless transition.

1 min read

Migrating Macs

ℹ️
Work in Progress

Migration Windows Devices

Migrating from Intune

Follow these steps to migrate your devices from Intune:

Upload the following script

  • Find your full MDM URL:
    • The format is: https://REPLACE_BY_COMPANY_NAME.mdm.getprimo.com/api/mdm/microsoft/discovery
    • Replace REPLACE_BY_COMPANY_NAME with the company name / domain that is present in the Fleet URL
  • Paste it in the script, replacing INPUT_URL_HERE
  • Upload the script on the your MDM instance (Controls > Scripts)
$EnrollmentsPath = "HKLM:\SOFTWARE\Microsoft\Enrollments\"
$Enrollments = Get-ChildItem -Path $EnrollmentsPath
$DiscoveryServerFullUrls = @("INPUT_URL_HERE")

Foreach ($Enrollment in $Enrollments) {
    $EnrollmentObject = Get-ItemProperty Registry::$Enrollment
    if ($EnrollmentObject."DiscoveryServiceFullURL" -in $DiscoveryServerFullUrls ) {
        $EnrollmentPath = $EnrollmentsPath + $EnrollmentObject."PSChildName"
        Write-Host "Suppression de l'inscription : $EnrollmentPath"
        Remove-Item -Path $EnrollmentPath -Recurse
        Write-Host "Inscription supprimée. Réinscription de l'appareil..."
        & "C:\Windows\System32\deviceenroller.exe /c /AutoEnrollMDM"
        Write-Host "L'appareil a été réinscrit."
    }
}

Create a policy to migrate

  • Re-use the URL from above
  • Paste it in the query below, replacing INPUT_URL_HERE
    SELECT 1 FROM registry 
    WHERE path LIKE 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Enrollments\%%'
    AND name =  "DiscoveryServiceFullURL"
    AND data NOT IN ("INPUT_URL_HERE")

Link script to policy

  • Navigate to Policies > No team
  • Click on “Manage automation” and link the script you uploaded to the newly created policy
Did this answer your question?