Error Details
| Fact | Value | Source | Note |
|---|---|---|---|
| Exact error string | 0x87D1041E (MENROLL_E_DEVICE_MANAGEMENTENABLED) | Intune admin center and device logs | -> Indicates the device is already managed |
| Affected OS builds | Windows 10, Windows 11 | Microsoft documentation | -> Applies to all supported versions |
| Registry key involved | HKLM\SOFTWARE\Microsoft\Enrollments | Registry Editor | -> Contains stale enrollment GUIDs |
| Relevant service URL | https://enterpriseregistration.windows.net | MDM event logs | -> MDM registration endpoint |
| Log line signature | Event ID 76: MDM enrollment error 0x87D1041E | Windows Event Viewer | -> Indicates enrollment conflict |
Log Files to Check
C:\Windows\System32\winevt\Logs\Microsoft-Windows-DeviceManagement-Enterprise-Diagnostics-Provider_Admin.evtxC:\Windows\System32\Config\Registry.hive (registry export)
What This Error Actually Means
The error code0x87D1041E (MENROLL_E_DEVICE_MANAGEMENTENABLED) indicates that the device is already enrolled in an MDM (Mobile Device Management) service, either from a previous Intune tenant, another MDM solution, or a partially completed enrollment process. This error is raised by the Windows MDM client when it detects conflicting enrollment records, preventing a new enrollment attempt. The conflict occurs at the device level, meaning the system believes the device is already managed by an organization, even if that management is no longer valid or intended.
Affected Versions and Scope
This error affects devices running Windows 10 and Windows 11, specifically builds where the MDM client is active. It occurs in environments using Microsoft Intune for device enrollment, particularly when transitioning between tenants, re-enrolling devices, or managing devices with mixed MDM configurations. Devices enrolled via Azure AD Joined (AADJ) or Hybrid Azure AD Joined (HAADJ) are more prone to this issue due to their reliance on MDM for policy application.Where To Look First: Logs and Event IDs
To diagnose the issue, examine the following logs:C:\Windows\System32\winevt\Logs\Microsoft-Windows-DeviceManagement-Enterprise-Diagnostics-Provider_Admin.evtx
Filter for Event ID 76, which contains the exact error string:
MDM enrollment error 0x87D1041E
Additionally, check the registry at:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Enrollments
for stale enrollment GUIDs that may be causing conflicts.
Use PowerShell to query event logs directly:
Get-WinEvent -LogName "Microsoft-Windows-DeviceManagement-Enterprise-Diagnostics-Provider/Admin" -MaxEvents 50 | Where-Object { $_.Id -eq 76 }
Root Causes
1. Stale Enrollment Record
The device retains enrollment information from a previous Intune tenant or MDM solution. This can occur if the device was enrolled in another organization without proper unenrollment.2. Group Policy Override
MDM enrollment via Group Policy (GPO) takes precedence over user-initiated enrollment. If GPO is configured for automatic enrollment with a different tenant, it blocks new enrollments.3. Incorrect User Scope Configuration
In Entra ID, the MDM user scope may be set to "None" or exclude the enrolling user's group, preventing successful enrollment.4. Partial Enrollment
An interrupted enrollment process left orphaned registry keys and scheduled tasks, causing the device to believe it is already managed.Fix Procedure
- Disconnect Stale Enrollments via Settings:
Settings > Access work or school > [Stale Connection] > Info > DisconnectIf "Disconnect" is greyed out, proceed to manual cleanup. - Manual Registry Cleanup:
Open Registry Editor as Administrator:
regedit.exeNavigate to:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\EnrollmentsDelete sub-keys with GUIDs that reference the old tenant. Also clear:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\EnterpriseResourceManager\TrackedandHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Provisioning\OMADM\Accounts\* - Remove Orphaned Scheduled Tasks:
Open Task Scheduler:
schtasks.mscDelete folders under:Microsoft > Windows > EnterpriseMgmtthat match stale enrollment GUIDs. - Adjust MDM User Scope in Entra ID:
Navigate to:
Entra admin center > Mobility (MDM and MAM) > Microsoft Intune > User scopeSet to "All" or include the enrolling user's group. - Verify GPO Configuration:
Check:
Computer Configuration > Administrative Templates > Windows Components > MDMEnsure "Enable automatic MDM enrollment using default Azure AD credentials" points to the correct tenant. - PowerShell Cleanup (Optional):
Use:
dsregcmd /statusto check device registration status. For forced cleanup, run:dsregcmd /unregister
Warning: Manually modifying the registry or scheduled tasks can destabilize existing enrollments. Proceed only if you are certain of the stale enrollment's origin.
Error Code Variants
| Error Code | Description |
|---|---|
| 0x87D1041E | Device already managed by another organization (this guide) |
| 0x80180026 | MDM enrollment blocked by policy (GPO or tenant restrictions) |
| 0x87D1041F | Device not enrolled in MDM but required for management |
Verification
After applying fixes, verify successful enrollment by: - CheckingSettings > Access work or school for the new tenant.
- Confirming device status as "Compliant" in Intune admin center under Devices > All devices.
- Reviewing Event Viewer for Event ID 75, indicating successful enrollment.
Use PowerShell to validate device status:
Get-MgDeviceManagementManagedDevice -Filter "deviceEnrollmentType eq 'windowsAutoEnrollment'"
Prevention
Implement the following measures: 1. Usedsregcmd /status regularly to audit enrollment states.
2. Enforce proper unenrollment procedures before re-enrollment.
3. Monitor Group Policy configurations for MDM settings.
4. Set MDM user scope to "All" unless selective enrollment is required.
TIP: Use
This comprehensive approach ensures devices are properly enrolled and prevents recurrence of the Get-WinEvent -LogName "Microsoft-Windows-DeviceManagement-Enterprise-Diagnostics-Provider/Admin" | Where-Object { $_.Id -eq 76 } to quickly identify stale enrollment attempts.
0x87D1041E error, maintaining smooth Intune management operations.