Intune Auto-Enrollment: Troubleshooting Errors and Stale Registrations

Infostruction banner: a person holding a mug stands in a dim home office lit by server racks and monitors, with the Infostruction logo and wordmark across the centre.

Intune enrollment failures tend to arrive as a pile of errors: an enrollment task fails, a token request fails, and the device sits there looking almost managed. Clearing everything and trying again can make the next diagnosis harder. Start by working out which part failed.

Updated November 3, 2026. This revision corrects the command paths, separates user-credential enrollment from device-credential scenarios, and replaces the old cleanup download. The revised script inventories by default and can remove only one explicitly selected enrollment ID.

First, identify the enrollment path

This article is mainly for administrators troubleshooting Windows automatic enrollment, including Microsoft Entra hybrid-joined devices using Group Policy. Autopilot, co-management, personal devices and Azure Virtual Desktop have different prerequisites. A cleanup script does not make those prerequisites interchangeable.

  • Confirm that the affected user has the required Intune and Microsoft Entra automatic-enrollment entitlement, is included in the MDM user scope, and is allowed to enroll this device.
  • Check enrollment restrictions, device limits, MFA and Conditional Access requirements before removing registrations.
  • For Group Policy enrollment, verify that Enable automatic MDM enrollment using default Microsoft Entra credentials is applied under Computer Configuration → Administrative Templates → Windows Components → MDM.

Use the credential type appropriate to that deployment. Microsoft’s Group Policy enrollment documentation limits Intune device-credential enrollment to co-management and Azure Virtual Desktop multi-session scenarios. The old advice to try both credential modes as general repair commands has been removed.

Collect evidence before changing the device

Run this in the affected user’s signed-in session. Keep the user context in mind when interpreting token information:

dsregcmd /status

For a hybrid-join deployment, check the join state and the user’s token state, including AzureAdJoined, DomainJoined and AzureAdPrt. Compare them with the intended configuration. An Entra device object by itself does not prove Intune enrollment is healthy.

Then open 64-bit PowerShell as administrator and inspect the enrollment tasks and recent MDM events:

Get-ScheduledTask |
    Where-Object TaskPath -like '\Microsoft\Windows\EnterpriseMgmt*' |
    Select-Object TaskPath, TaskName, State

Get-WinEvent -FilterHashtable @{
    LogName = 'Microsoft-Windows-DeviceManagement-Enterprise-Diagnostics-Provider/Admin'
    StartTime = (Get-Date).AddHours(-4)
} | Select-Object TimeCreated, Id, LevelDisplayName, Message | Format-List

Save the complete event message and timestamp. Errors such as 0x8018002a, 0xcaa2000c, 0x86000022 or HTTP 401 are evidence to investigate, not proof of a single stale-registration problem.

Separate a failed attempt from a missing trigger

Microsoft documents event 75 as successful automatic enrollment and 76 as failure. If neither appears around your test, inspect the enrollment task and applied policy. Task Scheduler event 102 only says that a task completed; it does not establish enrollment success. See Microsoft’s enrollment diagnosis guide.

For the Group Policy path, refresh policy after correcting its configuration:

gpupdate /force

Recheck the task and logs. Repeatedly forcing enrollment will not fix an excluded user, a failed join, or an authentication policy that blocks the attempt.

The cleanup script: one enrollment, explicitly selected

Download the revised Intune enrollment cleanup script. Save it as Intune-Enrollment-Cleanup.ps1. It requires Windows PowerShell 5.1 or later, administrator access, and a native 64-bit session on 64-bit Windows.

The previous download had a scope error: its final task-folder deletion did not respect the earlier choice to retain a registration. That behavior has been removed. Replace earlier saved copies with the dated revision linked here; older direct downloads are superseded.

# Inventory only; no cleanup
.\Intune-Enrollment-Cleanup.ps1

# Replace both placeholders with ONE inventory entry you have investigated.
.\Intune-Enrollment-Cleanup.ps1 -EnrollmentId 'YOUR-ENROLLMENT-GUID' -ExpectedUpn 'old@example.com' -Apply -WhatIf

A matching UPN does not establish that an enrollment is stale. Confirm the device, tenant, current management state and recovery access first. For an active enrollment, use the supported management/unenrollment process for that device. This script is a last-resort local cleanup of the historical locations listed in its source.

If that local cleanup is appropriate, repeat the reviewed command without -WhatIf and confirm the prompt. Before deletion, it exports existing selected registry keys and scheduled-task XML to a restricted backup directory. An export failure aborts cleanup. It unregisters only tasks belonging to the selected GUID and never deletes raw files from System32\Tasks.

Registry exports and task XML are recovery evidence, not a guaranteed reversal of enrollment. Preserve their manifest, protect the files, and have another way into the device before attempting cleanup.

What counts as fixed?

Check a new enrollment attempt, the device’s current Intune record, recent check-in, and delivery of an expected policy. Confirm the user can access required resources. A clean script exit or an empty event log is not enough.

Validation for this revision: PowerShell syntax and local regression checks for GUID selection, UPN mismatch, and a write-free WhatIf preview. The revised cleanup has not been tested against a live managed endpoint in this refresh.

Share your thoughts, leave a comment

Your email address will not be published. Required fields are marked *

You may also like these

INFOSTRUCTION

You're about to become an infostruction VIP!

By subscribing, you’ll receive a monthly round-up of the latest news. There’ll be no spam, I promise :)