Last active
August 5, 2022 17:07
-
-
Save mardahl/db57e7fca3926091a8c2d60461f08ad2 to your computer and use it in GitHub Desktop.
Intune Enrollment problem solver script thingy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Clean out MDM registration info from machine, in attempt to fix Intune enrollment problems with Windows 10 | |
# after a user reboots, the enrollment process should kick off again. | |
# This special edition, also disables workplace join, as an attempt to mitigate issues with devices previously AAD Registered. | |
# This script has fixed Error codes 0x80180023 and 0x8018002b at some of my customers sites, even without reboot in some cases. | |
# By Michael Mardahl @ Apento.com - @michael_mardahl | |
# Should be run as system user | |
#Disable workplace join if that is happening beyond your control. | |
#Get-ScheduledTask -TaskName "Automatic-Device-Join" | Disable-ScheduledTask | |
#Get-ScheduledTask -TaskName "Recovery-Check" | Disable-ScheduledTask | |
#you can try either one of the two following actions afterwards, or both (test test test).... | |
#Remove AAD registration from Machine. | |
& $env:WINDIR\system32\dsregcmd.exe /leave | |
#Re-run deviceEnrollment | |
& $env:WINDIR\system32\deviceenroller.exe /c /AutoEnrollMDM |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The issues can arise from computers that have mistakenly been workplace joined (Azure AD Registered) etc.
Try and mix the commands around, I found that it's a trial and error thing, and waiting is also key, sometimes you need to do the /leave command, and then wait like 8 hours, before restart.