Forum Discussion
Audi9112450
Jun 21, 2021Brass Contributor
Script to view users phone numbers or extensions in tenant
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!
- 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- Audi9112450Brass ContributorHello 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 🙂- janglissSteel Contributor
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.