This task must be submitted by the migration administrator for the auto-pilot device to remove the autopilot object in Entra ID.
This script searches the HKLM\SOFTWARE\Microsoft\Provisioning and the HKLM\SOFTWARE\Microsoft\Provisioning\Diagnostics for child keys that have Autopilot in their names. It will then delete these values and keys from the workstation.
Autopilot Cleanup.txt
Param ( |
) |
$output = New-Object BinaryTree.ADM.Agent.PSHelpers.PSOutput |
### Script Configurable Parameters ### |
# Parent Regisry Keys to search # |
$RegistryKeys = "HKLM:\SOFTWARE\Microsoft\Provisioning" , "HKLM:\SOFTWARE\Microsoft\Provisioning\Diagnostics" |
###################################### |
Write-Output "Evaluating $($RegistryKeys.Count) Registry Hive(s)" |
ForEach ($Key in $RegistryKeys) { |
Write-Output " Processing: $($Key)" |
If (Test-Path -Path $Key) { |
$StoreKey = Get-ChildItem -Path $Key | Where-Object {$_.Name -like '*Autopilot*'} |
Write-Output " Processing $($Storekey.Name.Count) Registry Entries" |
ForEach($S in $StoreKey){ |
Write-Output " $($S)" |
} |
Write-Output " Removing Registry Keys" |
ForEach($S in $Storekey){ |
Write-Output " Removing: $($S)" |
$S | Remove-Item -Recurse -Force -Confirm:$false -ErrorAction SilentlyContinue |
$KeyTest = Get-Item -Path Registry::$S -ErrorAction SilentlyContinue |
If([string]::IsNullOrWhitespace($KeyTest)){ |
Write-Output " Delete Suceeded" |
} |
Else{ |
Write-Output " Delete Failed" |
$KeyTest = $Null |
` } |
} |
} |
} |
return ($output) |
To allow enrolling the workstation into the target Intune, it is important to remove the source Intune Enrollment information. Otherwise, the workstation thinks that it is already part of an Autopilot/Intune Enrollment and will not try to enroll in the target. To accomplish this, Auto-pilot/Intune Cleanup option must be selected in the Entra ID Join Profile.
When the machine enrolls in the target Intune, it will look for an Intune Licensed user in M365 using the UserEmail value found in the workstation registry. By default, this value is set to the Bulk Enrollment user, which does not have the relevant license, and prevents the Intune service from running correctly.
The product performs this automatically during Entra ID Device Join when the Enroll into Intune Management option is selected in EntraID Device Join Profile. The product will update the UserEmail value in the following registry key, setting it to the UPN of the logged-on target user.
HKLM:\System\CurrentControlSet\Control\CloudDomainJoin\JoinInfo
© ALL RIGHTS RESERVED. Feedback 이용 약관 개인정보 보호정책 Cookie Preference Center