By | October 16, 2016

A few months ago my SIP address was changing and was looking for a way of exporting/importing my contact list. I wanted a solution to work no matter if the Lync/Skype for Business environment was on-premises, hosted or online. This led me down the path of playing with the Lync 2013 Client SDK:

If looking at pure on-premises and you have server access, look at the Export-CSUserData cmdlet in PowerShell ( But even then, I would say just grab Anthony Caragol’s Lync Contact Backup and Restore Tool (GUI):

A few months later, I had a client that was migrating between two hosted Skype for Business environments so I combined both my export and import contact list scripts.

The script can be found on TechNet Gallery:
Script Download: Invoke-SFBContacts

The parameters for Invoke-SFBContacts.ps1 is “Export” or “Import” for the mode and “File” used for the CSV file location. The script does require PowerShell v3 or newer.

If Invoke-SFBContacts.ps1 is run without any parameters the script will default to export mode and the contact list of the currently signed in Skype for Business account will be exported to c:\temp\SFBcontacts.csv. The CSV file has three columns, Group, Key and SIP. The Key column is used as a quick way of indicating unique entries, as a sip address could be a member of multiple groups. Also at this point the export function doesn’t work with Exchange Distribution Groups.

When Importing contacts there is a known issue where importing contacts into “Other Contacts” default group will fail (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) for contacts already added elsewhere in the contact list. I’ve blogged about issues with the “Other Contacts” group prior at: The script can run multiple times and only imports missing contacts.

A couple days ago a fellow MVP, Rodolfo Castro ( asked me if he could publish an exe version that used my script as an example. Of course I had no issue with this and you can find more details at:
Rodolf’s GUI looks like:

Although I’m still hoping for the day that the Skype for Business client get’s a builtin Contact Manager under the Tools menu. Until then you can find my script at:
Script Download: Invoke-SFBContacts

5 thoughts on “Invoke-SFBContacts

  1. Kory Olson


    I have been working on a similar script that can recover contacts from a UccapiLog. I can easily modify it to import and export, but one thing that I was able to do was to successfully handle Distribution Groups. Let me know if you would like to collaborate on adding this functionality to your script.

    1. mlamontagne Post author

      Hey Kory, hit me up on twitter @realtimeuc I’d be interested in added DG functionality.

  2. Frode Haugsgjerd

    Thanks, here is a fix to exclude your self, import crashes if this is not handled.

    $me = $SFBclient.Uri.Substring(4)
    foreach($SFBaddContact in $SFBiContacts){
    $global:isCompleted = $False

    if ($SFBaddContact.Sip -ne $me)
    $NewContactResult = Add-LyncContact -GroupName $SFBaddContact.Group -ContactUri $SFBaddContact.Sip
    while(!($global:isCompleted -eq $True) ){
    Start-Sleep -M 30

    1. MLamontagne

      I added your recommendation Frode, can you explain the scenario where you have your own SIP address in the Contact list?


Leave a Comment