There are times when you may need to run PowerShell scripts (for diagnostics or advance configurations)

The steps below will explain how to obtain and run this.

Microsoft have now upgraded their PowerShell Modules for Microsoft Teams - For more information please click here


1 Get the latest PowerShell version from https://github.com/PowerShell/PowerShell/

2 Run Powershell from the start menu

3 install the Microsoft Teams Module

Install-Module MicrosoftTeams -AllowClobber

By default, the PowerShell Gallery (PSGallery) isn't configured as a trusted repository for PowerShellGet. The first time you use the PSGallery, you'll see the following message:

Untrusted repository You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the `Set-PSRepository` cmdlet. Are you sure you want to install the modules from 'PSGallery'? [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"):

Answer Yes or Yes to All to continue with the installation.

Connect using a 365 admin account

  1. Open a Windows PowerShell command prompt window, and run the following commands:

    Import-Module MicrosoftTeams
    $sfbSession = New-CsOnlineSession
    Import-PSSession $sfbSession
  2. You should get a 365 pop up in which you will need to enter the Global 365 admin details.

  3. Once completed you will be able to run commands (Example below)

    Get-CsOnlineUser -Identity "Alex Wilber"

Get a list of all users the are EnterpriseVoiceEnabled

Get-CsOnlineUser | Where-Object {$_.enterprisevoiceenabled -eq "True"} |select DisplayName, UserPrincipalName| out-gridview

- Once a user is added to the portal and a Sync is run they should populate in this list. - If Not then you may need to run another sync.