Update: 28-May-2014 – Just released Version 0.2 which fixes the issue with connecting to local SQL server. thanks to Paul Bloem for the feedback.
Recently I had a weird problem with a Lync client in which his contacts list were not shown on his mobile device, but did on the Lync desktop client.
To make a long story short, the only solution was to remove the Lync user from the Lync environment and re-enable it again and adding all of his contacts from scratch without the option to use Import-CsUserDate (as the old data was exported in a corrupted XML structure).
In order to prepare the user for that action, I decided to export all of his existing contacts list, unfortunately I couldn’t find an easy way in which I can just provide the user with a list of his Contacts list, as the Export-CsUserData is exporting it to an XML file which is not the most convenient way to read a file from an end user perspective.
That was the trigger for writing the following script. This script will output a Lync User contacts list to a selected export option (Screen, CSV or Gridview).
This script is meant to list the contact list of a user in a simple way, taken out of the Lync local SQL database and it cannot be used for import purposes unless combined with other script such as Bulk Import Contacts for Lync 2013 which allow you import contacts from a CSV file.
the original SQL query is taken from the following link