I wrote a quick little application that will let you view all of the contacts assigned to the users of your Lync 2013 pool. It queries the SQL database on the Front End pool directly and the output is sent to PowerShell’s Out-GridView which will allow you to sort and filter. This gives you the power to search for contacts that have left the company that still remain in user’s contact or buddy lists. Additionally, it can just allow you to peek into the user’s contact lists for troubleshooting. To run it, just start it up from a Lync server, your desktop, or just about anywhere. It will automatically elevate itself to administrative mode (this is to ensure access to the RTCLOCAL database when being run from a Front End server) and ask for the FQDN of a Front End pool. Click OK and in moments, you’ll have all of your contact data before you.
There’s one big caveat here, as expected if you have enabled the Unified Contact Store feature for your users, the contacts are no longer stored in Microsoft Lync and are therefore unavailable to the tool. You won’t receive an error but it may not show results for the users.
The tool can be freely downloaded here from the TechNet Gallery: http://gallery.technet.microsoft.com/Show-All-Lync-Contacts-59b14f30
Please let me know if there’s anything I can do to improve upon it or make it work for you!