Exchange – Lync – Contacts (duplicate)

Remove duplicate contacts in Lync




I have been fighting quite a bit with this one. In short – yes, the contacts can be deleted one by one via the OWA – but with 2500 duplicates – and unable to mark multiple contacts,ย I didn’t really think this was the way to go.

So after a lot of trial and error – this is whatย I ended up with, and it finally worked (for me ๐Ÿ™‚ ) – and i had a few, a lot happier users!


So! To jump right in to it. You will need access to the affected users Lync and Outlook client. You will also need admin-rights on the Exchange server, so we can use some epic PowerShell ๐Ÿ™‚


On the Lync Client, Set Personal Information Manager to None.

1. Client

Start with disabling the link between Outlook and Lync contacts:

The Lync contacts exists on the Lync server โ€“ NOT in the mailbox. Therefore, we do not really care about those โ€“ only the contacts in Outlook.





On the Exchange server, open a PowerShell

2. Exchange powershell

First of all โ€“ backup the contacts in the mailbox. (remember to change user and path. Path MUST be a share.)



New-MailboxExportRequest USER -IncludeFolders “#Contacts#” -ExcludeDumpster -FilePath \\server\share\file.pst -name USER_Contย  -acceptlargedataloss -baditemlimit 999



Where -name is the Export JOB name.


This produces a .PST file you can open directly with Outlook when we need to import them again.
(You could of course do this from the PowerShell as well, but ill leave it up to you ๐Ÿ˜‰ )




Now delete the contacts.. WARNING โ€“ this deletes ALL contacs in the mailbox.. if you have some sort of clever folder structure with contacts outside the โ€œ#Contact#โ€ folder โ€“ remember to export them.



Remember to change USER.

Search-Mailbox -Identity USER -SearchQuery “kind:contacts”ย  -DeleteContent



3. Exchange powershell


On the Client


Now โ€“ open the .pst file you exported before in Outlook (FILEย –> OPEN) and go to the PEOPLE section.

Drag all the contacts from the file to your mailbox contacts. This takes a while depending on the number of contacts.



Finally โ€“ go to Lync โ€“ and enable the Personal Information manager again:

4. client

Both phones, outlook and what not should be up to date very quickly with the contacts, and the Lync Contacts should return again within a few minutes.



All done! ๐Ÿ™‚


Leave a comment

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