Zachary Loeber

The personal website of Zachary Loeber.

Lync UCS Contacts Reporting with Powershell

By default a Lync enabled account within a Lync/Exchange 2013 environment will be enabled for UCS (Unified Contact Store). This means that the Lync contacts get saved in the Lync user’s mailbox and not the Lync database. In order to get a list of the contacts associated with these accounts you have to export data to a zip file with some debug Lync commands and, even then, the information is buried in a hard to interpret XML file.

I had a need to validate the contacts which were getting stored in UCS for Lync users and so I came up with this script to accomplish the task. It creates a temporary directory and exports all the passed Lync users’ UCS contact information in a zip file within the directory. The function then parses and returns psobjects with the contact information by reading in the xml file directly from the zip file (no extraction to disk). After returning contact information back as nicely formatted powershell objects the temporary files are all cleaned up.

Here are a few small examples of what can be done:

.EXAMPLE 
$a = Get-LyncUCSContacts test* 
 
Description 
----------- 
Get all ucs contact information for all lync and ucs enabled users in the environment matching the name test* 
 
.EXAMPLE 
Get-CSUser -Resultsize Unlimited | Get-LyncUCSContacts | Export-CSV -NoTypeInformation UCSContacts.csv

You can download this script at the Microsoft Technet Gallery or at my new Github repo.

comments powered by Disqus