Installing and Managing the Microsoft Teams PowerShell Module

Overview

The Microsoft Teams PowerShell module provides a powerful set of cmdlets and tools for managing various aspects of Microsoft Teams, including creating and configuring teams, managing users and permissions, and automating Teams-related tasks. In this comprehensive guide, we’ll walk through the process of installing the module, signing in, updating, and uninstalling it, as well as explore the next steps for managing Microsoft Teams using PowerShell.

Requirements

To use the Microsoft Teams PowerShell module, you’ll need to have Windows PowerShell 5.1 or PowerShell 7.2 (or later) installed on your system. If you’re not sure which version of PowerShell you have, you can check by running the following command in a PowerShell session:

$PSVersionTable.PSVersion

Additionally, you’ll need to have the .NET Framework 4.7.2 (or later) installed on your system.

Installing the Module

The recommended way to install the Microsoft Teams PowerShell module is to use the PowerShell Gallery, which is the central repository for PowerShell modules and scripts. Follow these steps:

  1. Update PowerShellGet: Run the following command to install the latest version of the PowerShellGet module:

    Install-Module -Name PowerShellGet -Force -AllowClobber
    
  2. Install the Microsoft Teams PowerShell Module: Run the following command to install the latest version of the Microsoft Teams PowerShell module:

    Install-Module -Name MicrosoftTeams -Force -AllowClobber
    

    If you see a message about the PowerShell Gallery being an untrusted repository, answer Yes or Yes to All to continue with the installation.

Offline Installation

In some environments, it may not be possible to connect to the PowerShell Gallery. In such cases, you can follow the manual installation steps to download the module and install it offline.

Signing In

Before you can start using the Microsoft Teams PowerShell module, you’ll need to sign in with your Azure credentials. Run the following command to sign in:

Connect-MicrosoftTeams

Updating the Module

To update the Microsoft Teams PowerShell module, you can use the same method you used to install it:

Update-Module MicrosoftTeams

[!WARNING] If the Teams PowerShell module has already been imported into your PowerShell session, updating the module will fail. In this case, close your PowerShell session and open a new elevated PowerShell session before running the update command.

Uninstalling the Module

If you need to uninstall the Microsoft Teams PowerShell module, run the following command in a new PowerShell session:

Uninstall-Module MicrosoftTeams

To uninstall all versions of the module, use the following command:

Uninstall-Module MicrosoftTeams -AllVersions

Next Steps

Now that you have the Microsoft Teams PowerShell module installed and ready to use, you can explore the Managing Teams with Teams PowerShell article to get started with managing Microsoft Teams using PowerShell.

Source: https://raw.githubusercontent.com/MicrosoftDocs/OfficeDocs-SkypeForBusiness/live/Teams/teams-powershell-install.md