Intune groups with duplicate devices

Becca Hamilton 20 Reputation points
2025-03-18T10:55:57.7333333+00:00

When adding devices to groups I'm finding that if a device had previously been assigned to a user and reset there is then muliple entries for the device when adding to a group. In the device tab there is only one entry for the serial number but when adding a group member there are as many as there have been resets on the device - these show as having the same name but with different codes in the details. Is there a way to remove the entries so only the active device is added to the group?
As it is I'm having to add all devices with the serial to ensure the right one is added.

Microsoft Intune Grouping
Microsoft Intune Grouping
Microsoft Intune: A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.Grouping: The arrangement or formation of people or things in a group or groups.
70 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jose Benjamin Solis Nolasco 1,066 Reputation points
    2025-03-18T12:24:30.3166667+00:00

    Hello Becca Hamilton

    This is a known scenario when devices are reset or re‑enrolled in your environment. In Azure AD (and by extension in Intune or similar device management solutions), every time a device is reset and then re‑enrolled, a new device object is created—even if it carries the same serial number or name. Although for many management screens (like the device list in Azure AD) you might see only one "active" entry per serial number, other places (such as the group membership add dialog) can show every historical record.

    1. Manual Deletion: Use the Azure AD portal to review your device list and remove the stale records.
      • In the Azure portal, go to Azure Active Directory > Devices.
      • Identify the extra records (often you can sort by "Last seen" or "Enrolled date") and delete the obsolete ones.
    2. Automated Cleanup with PowerShell or Graph API: Write a script that queries for duplicate devices (for example, based on serial number or display name), filters out the active record, and then deletes the older/inactive ones.
    3. An example PowerShell snippet might start with: powershell
    Connect-AzureAD
    $devices = Get-AzureADDevice | Where-Object { $_.DisplayName -eq "YourDeviceName" }
    # Evaluate $devices and decide which ones are stale (e.g., based on CreationDate or LastLogon)
    $devices | ForEach-Object { Remove-AzureADDevice -ObjectId $_.ObjectId }
    

    Remember to test any automated deletion in a non‑production environment first.

    If possible, consider modifying how devices are re‑enrolled. For instance, a cleanup step can be built into your reset workflow that removes the previous record before re‑enrollment occurs.

    😊 If my answer helped you resolve your issue, please consider marking it as the correct answer. This helps others in the community find solutions more easily. Thanks!

    2 people found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.