Install Microsoft Teams PowerShell

This article explains how to install the Microsoft Teams PowerShell module using PowerShellGet. These instructions work on Azure Cloud Shell, Linux, macOS, and Windows platforms.

Requirements

Teams PowerShell requires PowerShell 5.1 or higher on all platforms. Install the latest version of PowerShell available for your operating system.

Warning

There are known issues with PowerShell 7 and Teams PowerShell. For the best experience, we recommend that you use PowerShell 5.1.

Install the Teams PowerShell module

Note

For the best experience, use either General Availability (GA) or Public Preview modules - not both. They're not intended to work together.

Use the PowerShellGet cmdlets to install the Teams PowerShell module. Installing the module for all users on a system requires elevated privileges. Start the PowerShell session using Run as administrator in Windows or use the sudo command on macOS or Linux:

Install-Module MicrosoftTeams

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.

Install Teams PowerShell public preview

Note

If you're using the Public Preview version of Teams PowerShell, we strongly recommend that you first uninstall Skype for Business Online Connector.

Installing the Teams PowerShell public preview module for all users on a system requires elevated privileges. Start the PowerShell session using Run as administrator in Windows or use the sudo command on macOS or Linux.

If you're using PowerShell 5.1, you must update the PowerShellGet module beforehand. After you update PowerShellGet, close and reopen an elevated PowerShell session to ensure that the latest PowerShellGet is loaded.

Install-Module PowerShellGet -Force -AllowClobber

To install Teams PowerShell public preview, run the PowerShell command below.

Note

You can find the latest preview version at PowerShell Gallery or in PowerShell by running "Find-Module MicrosoftTeams -AllowPrerelease"

Install-Module MicrosoftTeams -AllowPrerelease -RequiredVersion "1.1.9-preview"

Install the Skype for Business Online Connector

Note

Skype for Business Online Connector is currently part of the latest Teams PowerShell module. If you're using the latest Teams PowerShell public release, you don't need to install the Skype for Business Online Connector.

Import-Module -Name MicrosoftTeams
$userCredential = Get-Credential
$sfbSession = New-CsOnlineSession -Credential $userCredential
Import-PSSession $sfbSession

Sign in

To start working with Teams PowerShell, sign in with your Azure credentials.

Note

If you're using the latest Teams PowerShell public preview release, you don't need to install the Skype for Business Online Connector.

$credential = Get-Credential

#Connect to Microsoft Teams
Connect-MicrosoftTeams -Credential $credential

#Connection to Skype for Business Online and import into Ps session
$session = New-CsOnlineSession -Credential $credential
Import-PsSession $session

Update Teams PowerShell

To update Teams PowerShell, open a new elevated PowerShell command prompt and run the following:

Update-Module MicrosoftTeams

Warning

If Teams PowerShell has already been imported into your PowerShell session, updating the module will fail. Close PowerShell and re-open a new elevated PowerShell session.

Uninstall Teams PowerShell

To uninstall Teams PowerShell, open a new elevated PowerShell command prompt and run the following:

Uninstall-Module MicrosoftTeams

Warning

If Teams PowerShell has already been imported into your PowerShell session, uninstalling the module will fail. Close PowerShell and re-open a new elevated PowerShell session.

Next Steps

Now you're ready to manage Teams using Teams PowerShell. See Managing Teams with Teams PowerShell to get started.

Managing Teams with Teams PowerShell

Teams PowerShell Release Notes

Microsoft Teams cmdlet reference

Skype for Business cmdlet reference