The Microsoft Teams PowerShell module

With the Microsoft Teams PowerShell module you manage Teams faster than in the admin center: create teams, add members in bulk, assign policies or build reports. This article shows how to install the module, connect and use a few handy commands.

Install the module

  1. Open PowerShell 7 (recommended) or Windows PowerShell 5.1. Read install PowerShell 7.
  2. Type: Install-Module -Name MicrosoftTeams -Scope CurrentUser
  3. Confirm the PSGallery prompt with Y (or A for all).

Update later with Update-Module MicrosoftTeams.

Installing the Microsoft Teams PowerShell module

Connect

Type Connect-MicrosoftTeams. A sign-in window opens; sign in with an admin account and confirm with MFA. You need at least the Teams Administrator role. Disconnect with Disconnect-MicrosoftTeams.

Handy commands

CommandWhat it does
Get-TeamList all teams
New-Team -DisplayName "Sales" -Visibility PrivateCreate a private team
Add-TeamUser -GroupId <id> -User john@contoso.comAdd a member
New-TeamChannel -GroupId <id> -DisplayName "Quotes"Create a channel
Get-CsTeamsMeetingPolicyList meeting policies
Grant-CsTeamsMeetingPolicy -Identity john@contoso.com -PolicyName "Students"Assign a policy to a user

Adding many members? Read add multiple members at once.

Tips

Read also

Install the Exchange Online PowerShell module (ExchangeOnlineManagement)
Install, update and use PowerShell 7 on Windows
Add multiple users to a team at once in Microsoft Teams

Nederlandstalige versie: De Microsoft Teams PowerShell-module installeren en gebruiken


More in English