Every time when you rebuild (reinstall Windows and Intune client) a corporate PC witch was already managed by Intune a duplicate computer record is added to Intune database. Now we manually removing duplicates every month. Can you automate it?
I still do not get why these "duplicates entries" have an impact on your side... I get the point that some entries have an identical "deviceName" attribute, but technically, they have a different ID attribute!
If you run a GET query "https://graph.microsoft.com/v1.0/devicemanagement/managedDevices", you will certainly see/understand this. The fact that Azure Intune GUI shows you several devices with same string inside the "Device name" column, is sth you must deal with. The old times where you relied on AD/LDAP where you must had a unique computer name, is gone. Now it is the "ID" of the object that is unique.
The same would happen if you have 10 machines enrolled by 10 employees to Intune, and suddenly they all decide to rename their computer to "My computer" for fun : you will end up with 10 entries in Intune for your 10 computers having the same "Device Name", but what impact does it really have on your side?
So IMO, there is nothing to fix, nor to improve here.
Intune should retire devices based on Serial number & enrollment date. Move all dup. devices with older dates to a new "Retired" section?
Tristan van Onselen commented
Their is a possibility to remove the duplicated serial numbers via the PowerShell CMDlet. An example is described at the blog below.
@Brian : There is already a feature that deletes old devices, called "Automatic device cleanup". Unfortunately, we also found it is not working like explained in the docs, and have a ticket open since few days on this...
The stuff that you or Sergey noticed, is not a bug : every device is uniquely identified through its "device.id", not through its serial number.
Unfortunately, there is no technical way for Intune to magically guess if a device object must be immediately deleted from the DB, after you enroll it one more time.
For mobile devices, it is obviously difficult to "clone" such hardware. But if you are working with Windows VMs, and especially with snapshots, then you get the point that 1 serial number can represent more than 1 device from Intune device object point-of-view. Not even talking about working with snapshots, make it even more difficult to keep 1 unique Intune record.
FYI : nearest MDM Microsoft competitor operates the same way : if you enroll several times the same device, you end up with several times the same SN in your DB. This is just a habit to modify, compared to what you are used to in on-prem AD world.
Brian McFarlane commented
Same problem exists for MacOS devices. A setting that auto deleted duplicate serial number devices that haven’t been active in X days would do the trick.
Has anyone found a way to script this type of thing?
Julien HACQUARD commented
Same issue really painfull and my technical director expect really more from this product so at this time for him this is not ready to be use in a production environment. Sad situation. You have an easy way to discover the machines per their serial number so do a match should not be so ******* your side during the enrollment.
Please answer us. This request for Sergey has 2 years and since i know the product this has always be like that unfortunately.
Kaye Cee commented
We have the same issue. I raised a ticket with MS Intune support but it seems like they don't know the solution to this problem. (FYI we're not subscribed to MS Azure A.D.)
We are having the same issue but instead we are managing iphones, same as above it seems to duplicate when you try to enroll a device which was managed before. Also Intune does sometime say the device is being deleted but it takes such a long time for intune to remove a device. Any way to force the purge or to do a sync?