Do yo want to export all of your onpremise Lync users? With the below script, you can do that. You will obtain a CSV with all SIP Adrress.
Hope it helps
# Lync 2010 export using dbimpexp # .Dbimpexp.exe /hrxmlfile:filename.xml /restype:user /sqlserver:SQLserverinstance # Lync 2013 export using powershell # Export-CsUserData -LegacyFormat -PoolFqdn pool.fqdn -FileName filename.xml # Amend import file name [xml]$contact = Get-Content d:filename.xml #output file $outputfile = “d:Contacts.csv” $output = $contact.HomedResources.homedresource # Declare an array to collect our result objects $resultsarray =@() foreach ($user in $output) { $contactlist = “” $contactObject = new-object PSObject $sipaddress=$user.userathost $user_contacts=$user.contacts.contact # Here we search the contact list and add the contacts to a new variable, separating each with a comma foreach($buddy in $user_contacts) {$contactlist = $contactlist + $buddy.buddy+”,”} # Here we now add the users information to the CSV file, we’re just adding their sip address and contacts in this process $contactObject | add-member -membertype NoteProperty -name “SIP Address” -Value $sipaddress $contactObject | add-member -membertype NoteProperty -name “Contacts” -Value $contactlist $resultsarray += $contactObject } #Now we’re saving the information to a single CSV file but you could save it individually. $resultsarray| Export-csv $outputfile -notypeinformation