Forum Discussion

hernan-invosys's avatar
hernan-invosys
Copper Contributor
Jul 15, 2020

Powershell user phone number

Hello guys, 

I'm using Powershell to connect to MicrosoftTeams.
I would like to retrieve the users phone number, like I can see when access https://admin.teams.microsoft.com/users.
The cmdlet Get-TeamUser only shows UserId, User, Name and Role. 

 

Is there any option, any other command, or any other connection that shows the phone number? 

 

Thanks for your help.

Hernan

  • hernan-invosys 

     

    Hey,

    You can use the Skype for Business PowerShell module.

     

    https://www.microsoft.com/en-us/download/details.aspx?id=39366

     

    Once installed, connect to the shell using :

    Import-Module SkypeOnlineConnector
    $sfboSession = New-CsOnlineSession
    Import-PSSession $sfboSession -AllowClobber
    Enable-CsOnlineSessionForReconnection

    I use the following command to get all the users with a telephone number assigned.

    Get-CsOnlineUser | Where-Object  { $_.LineURI -notlike $null } | select UserPrincipalName, LineURI

    Hope this helps.

    Steve. 

  • S_Thomspon's avatar
    S_Thomspon
    Copper Contributor

    hernan-invosys 

     

    Hey,

    You can use the Skype for Business PowerShell module.

     

    https://www.microsoft.com/en-us/download/details.aspx?id=39366

     

    Once installed, connect to the shell using :

    Import-Module SkypeOnlineConnector
    $sfboSession = New-CsOnlineSession
    Import-PSSession $sfboSession -AllowClobber
    Enable-CsOnlineSessionForReconnection

    I use the following command to get all the users with a telephone number assigned.

    Get-CsOnlineUser | Where-Object  { $_.LineURI -notlike $null } | select UserPrincipalName, LineURI

    Hope this helps.

    Steve. 

Resources