Script to view users phone numbers or extensions in tenant

%3CLINGO-SUB%20id%3D%22lingo-sub-2467734%22%20slang%3D%22en-US%22%3EScript%20to%20view%20users%20phone%20numbers%20or%20extensions%20in%20tenant%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2467734%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%26nbsp%3B%3C%2FP%3E%3CP%3EWe%20are%20moving%20from%20Skype%20Online%20to%20Teams%20and%20we%20are%20assigning%20extensions%20to%20our%20users.%26nbsp%3B%3C%2FP%3E%3CP%3EDoes%20anyone%20know%20of%20a%20simple%20script%20that%20can%20output%3C%2FP%3E%3CP%3E%22Username%22%20and%20%22Teams%20Phone%20Number%20or%20Teams%20Extension%22%3C%2FP%3E%3CP%3EI've%20tried%20a%20few%20scripts%20but%20nothing%20seems%20to%20give%20me%20the%20information%20I%20need.%3C%2FP%3E%3CP%3EThanks!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2467734%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Eextension%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Enumber%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Ephone%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ETeams%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2468304%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20view%20users%20phone%20numbers%20or%20extensions%20in%20tenant%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2468304%22%20slang%3D%22en-US%22%3EIf%20you%20already%20have%20a%20phone%20number%20assigned%20to%20users%20in%20Skype%20for%20Business%20you%20don't%20have%20to%20assign%20it%20when%20moving%20to%20Teams%20Only.%3CBR%20%2F%3E%3CBR%20%2F%3EThis%20PowerShell%20oneliner%20will%20show%20you%20all%20users%20with%20their%20assigned%20phone%20number%20(LineURI).%3CBR%20%2F%3EGet-CsOnlineUser%20%7C%20ft%20UserPrincipalName%2C%20LineURI%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2478981%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20view%20users%20phone%20numbers%20or%20extensions%20in%20tenant%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2478981%22%20slang%3D%22en-US%22%3EHello%20Linus%2C%3CBR%20%2F%3EThanks%20for%20the%20answer.%20That%20one%20liner%20does%20what%20I%20want%20it%20to%20do%20but%20strangely%20when%20I%20add%20the%20%7C%20Export-CSV%20-Path%20c%3A%5Cmypath.csv%20to%20get%20it%20in%20an%20excel%20file%20it%20writes%20something%20in%20the%20file%20but%20it's%20all%20the%20same%20line%20for%2020%20000%20lines.%3CBR%20%2F%3EAny%20idea%20how%20to%20get%20that%20info%20in%20readable%20form%20in%20a%20csv%20file%3F%3CBR%20%2F%3EThanks%20%3A)%3C%2Fimg%3E%3C%2FLINGO-BODY%3E
Occasional 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!

4 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!
www.000webhost.com