top of page
Search
  • Writer's picturesamanthaeasterday

How to get SIP and LineURI from an Active Directory group


As we start moving users to TeamsOnly (from our onpremises SfB, EV enabled) with direct routing. Microsoft recommends you to do a few extra steps.

Because of this, I needed to find a way to pull user's sip addresses and LineUri's from Skype, by using active directory. This seems simple enough, but believe it or not, I couldn't find a working script from any of the articles I read. So I pulled from the information out there and did it myself.

What this script does is get the members from an AD group. Gets the properties of the user principal name and exports to a file.

I then import that file, set a variable to look for the UPN and run a SfB command Get-CSUser, to pull out the sip address and lineuri. This is important because if you were to simply pull the telephone number from AD, you wouldn't get the full line uri with the tel:+ and if you have any extensions, you need the ;xxxx at the end. The easiest place to pull that information from is Skype.

Then I exported the information to a new clean .csv.


Copy starting here:


Get-ADGroupMember -Identity “Group Name” |

Where-Object{ $_.objectClass -eq 'User' } |

Get-ADUser -Properties userprincipalname | Export-csv -path c:\temp\file1.csv -NoTypeInformation


$csv = Import-Csv -Path c:\temp\file1.csv

$csv | Foreach-object {

$Upn = $_.UserPrincipalName

Get-csuser -identity $upn| select-object sipaddress,LineURI |

Export-csv -path c:\temp\file2.csv -NoTypeInformation -Append}



558 views0 comments
bottom of page