Script to view users phone numbers or extensions in tenant

Brass Contributor

Hello, 

We are moving from Skype Online to Teams and we are assigning extensions to our users. 

Does anyone know of a simple script that can output

"Username" and "Teams Phone Number or Teams Extension"

I've tried a few scripts but nothing seems to give me the information I need.

Thanks!

5 Replies
If you already have a phone number assigned to users in Skype for Business you don't have to assign it when moving to Teams Only.

This PowerShell oneliner will show you all users with their assigned phone number (LineURI).
Get-CsOnlineUser | ft UserPrincipalName, LineURI
Hello Linus,
Thanks for the answer. That one liner does what I want it to do but strangely when I add the | Export-CSV -Path c:\mypath.csv to get it in an excel file it writes something in the file but it's all the same line for 20 000 lines.
Any idea how to get that info in readable form in a csv file?
Thanks :)

@Audi9112450 

 

I think this is the result of using Format-Table as it creates a display object, not the data. I'd make a minor tweak to the code, and instead of format-table, I'd just use select-object.

 

Get-CsOnlineUser | Select UserPrincipalName,LineUri | Export-Csv -NoTypeInformation c:\temp\users.csv

 

Format-Table is great for presentation, but it can mess up when putting out to a file.

Hello,
It's been a while since I looked at this thread but alternatively is there a similar way to view what numbers I have assigned in my Skype On Prem tenant?
I'd like to be able to get an extract of who is using what number in Skype.
Thanks!
Yes, you can do the same using Get-CsUser on an on-prem Skype Server environment.