Skype for Business is a great communications platform. And as with any form of communication, both inside and outside the company there are always desires to audit who users are communicating with.

Maybe you’re looking to see if users are talking to your direct competitors, or maybe you need to disable open federation and don’t want to break any of your existing federation relationships?

There are a few ways you could tackle this.

You could write your own custom reports for the QoE database, Every conversations session information is stored in there, but is complicated to query and slow to write data for

You could get every user to send you their contact lists, but that requires a fair amount of bothering users and data collation.

So I wrote a simple script to do it for you!

This script iterates through an XML file generated by the Lync 2013 Export-CsUserData cmdlet and produces an HMTL report of external federated domains


This script will pull data from an existing DocItemSet.xml from an Export-CsUserData export if it is present in the current directory, Otherwise it will prompt you for a Front End to export the data from. (Note, the automated export function requires PowerShell 5 or better)

To use it offline or with PowerShell 3 you will need to export your existing user data by running 

Export-CsUserData -PoolFQDN "" -Filename ""

Once you have, open the ZIP file and place the DocItemSet.xml in the same folder as this script.

Run the script and it will generate a HTML report with all the domains that users have saved in their contact lists and how frequently they have been found.

The script will then open the HTML report

Optional Command Line Parameters


Stops the script from checking online for an update and prompting the user to download. Ideal for scheduled tasks


Stops the script from generating a HTML report, instead, results will be placed in the Pipeline to be picked up by another script or displayed on the screen


Instead of just listing the domains in the contact list, this will list every unique contact stored in every user’s Lync/Skype contact list.
Be careful! The output of this setting will contain personal data and should be treated as such.


Stops the script from using Get-CsSipDomain and removing all the local domains, Handy if you want to report on internal usage too or are running the script offline from your Skype4B enviroment

Known Issues

Depending on how you export your CsUserData you may get a bunch of weird-looking GUID contacts. These are from your SIP application accounts and can be safely ignored.

Fork me!

This script is free, open-source and licensed under the MIT Licence. Feel free to view the source, fork it, raise issues and submit your improvements via pull requests. You can find on Github:

As always, I hope this script has been helpful.

Revision History

v1.1: The "I rushed 1.0 out to quickly build"

Now sorts the output object by count thanks to Fefaul. By default the script will now remove the local domain from the results if it detects its running on a Skype4B server. Use -IncludeLocalDomain to disable this feature. Thanks Greig Added built in export feature (Requires PowerShell v5!) Fixed HTML formatting issue with certain domain names Progress Bars Typo corrections. Signed Code

v1.0: Initial Release


Testing and Advice

Greig Sheridan @greiginsydney

Auto Update Code

Pat Richard @patrichard

Proxy Detection

Michel de Rooij

Code Signing Certificate


Report Sorting


Progress Bars

Mark Wragg