Getting started with Teams PowerShell

Published by Satyajit Paul on

Getting started with Teams PowerShell

Teams PowerShell is a collection of cmdlets designed to interact with Teams elements and elements from PowerShell. We can interact with Microsoft Teams objects like – channels, users, etc. via dedicated and simple PowerShell cmdlets. A few use cases where it can be used are – 

  • Bulk update of users in Teams
  • Automate creation of Teams and Channels
  • Monitor activities in Teams

System Assumptions:

This article assumes that the user is using Windows and Windows PowerShell or PowerShell ISE.

Version Releases:

There are two releases of PowerShell modules – 

  • General Availability
  • Public Preview

As per Microsoft recommendations, it is advisable to use either of them, and not both.

Installation Steps:

Please follow the below steps to install Teams PowerShell

Install Windows PowerShell (or ISE)

Windows 10 and above have PowerShell ISE already installed in them. If is not present in the system, it can be installed from here. Also, it is necessary to install PowerShell 5.1 or higher. 

Install NuGet Package Manager

Nuget is a package manager that needs to be installed before moving to the next steps. It can be installed via the below code.

Install-PackageProvider -Name NuGet -Force
Install PowerShellGet

PowerShellGet is a module installer which is necessary for installing the Teams PowerShell module. It can be installed via the below command.

Install-Module -Name PowerShellGet -Force 
Install Teams PowerShell

Finally, we can install Teams PowerShell via this command below. 

Install-Module MicrosoftTeams

In the first run, users will be warned about installing modules from untrusted repository (as shown in screenshot above). Continue with “yes to all” to finish the installation. 

To check if TeamsPowershell in installed in your system, use the below command –

Get-Module -ListAvailable -Name MicrosoftTeams 

To update Teams Powershell, please use the below command

Update-Module MicrosoftTeams

This concludes the steps for installing Teams PowerShell.

Usage and Next Steps:

Now, we will establish a connection with our Teams (of Azure tenant) and test it out.

For connecting to Teams, type the command 

Connect-MicrosoftTeams.

You will be prompted for entering username and password. 

Upon successful authentication, the account and tenant details will be displayed in the screen. This indicates that the connection to Microsoft Teams was successful and we can proceed further.

To get the list of available commands, you can use this cmdlet –

Get-Command -Module MicrosoftTeams

As of today, there are 24 cmdlets and 6 functions in TeamsPowershell

To disconnect from the Teams instance, use the command below –

Disconnect-MicrosoftTeams 

This marks the end of this article. Thanks for stopping by and happy exploring Teams PowerShell!

Care to Share?

Satyajit Paul

SharePoint Developer with 6+ years of experience. Skilled in Add-in Development, BPM, CSOM and Migrations.

0 Comments

Leave a Reply