Having issue Azure AD joining a Windows 10 or 11 computer and getting error 8018000a? This script might help you. It deletes all keys except Context under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Enrollments
$EnrollmentsPath = “HKLM:\SOFTWARE\Microsoft\Enrollments\”
$Enrollments = Get-ChildItem -Path $EnrollmentsPath
$DiscoveryServerFullUrls = @(“https://wip.mam.manage.microsoft.com/Enroll”)
Foreach ($Enrollment in $Enrollments) {
$EnrollmentObject = Get-ItemProperty Registry::$Enrollment
if ($EnrollmentObject.”DiscoveryServiceFullURL” -in $DiscoveryServerFullUrls ) {
$EnrollmentPath = $EnrollmentsPath + $EnrollmentObject.”PSChildName”
Remove-Item -Path $EnrollmentPath -Recurse
& “C:\Windows\System32\deviceenroller.exe /c /AutoEnrollMDM”
}
}
References:
https://jocha.se/blog/tech/azure-ad-mdm-intune-error-8018000a