Getting Started with PowerShell for Microsoft Teams

Although you can manage Microsoft Teams through the Teams Admin Center, GUI based management tools tend not to scale very well. If you need to manage Teams in bulk, then using PowerShell will likely be a better option for you. In this article, I want to show you the basics of getting started with PowerShell based management for Teams.

Before you will be able to manage Teams using PowerShell, you are going to need to install a couple of modules – the PowerShellGet module and the MicrosoftTeams module. To install these modules, open an elevated PowerShell session and then enter the following commands:

Install-Module -Name PowerShellGet -AllowClobber
Install-Module -Name MicrosoftTeams -Force -AllowClobber


There are two modules that you will need to install.

It’s worth noting that the Microsoft Teams module takes a couple of minutes to install. If you have trouble installing the module then make sure that you are using PowerShell version 5.1 or higher and that you have version 4.7.2 or higher of the .NET Framework installed. You can check your PowerShell version by entering this commands:

Get-Host | Select-Object Version


Make sure that you are running PowerShell 5.1 or higher.

Getting the .NET version isn’t quite as straightforward, but there is a script available for download at: https://helpcenter.gsx.com/hc/en-us/articles/360001520328-How-to-Check-What-Version-of-NET-Framework-4-is-Installed-on-Your-Computer

Once the two required modules are installed, then the next thing that you will need to do is to connect to Microsoft Teams. To do so, just enter the following command:

Connect-MicrosoftTeams

When you enter this cmdlet, PowerShell may appear to freeze up for a moment. Eventually though, you should see a window appear asking you to log into Microsoft 365. It is worth noting that this window might not necessarily appear on top of the PowerShell window. When I entered the Connect-MicrosoftTeams command on my own system, the authentication window actually appeared on a different monitor.

Once you have connected to Microsoft Teams, then all of the prerequisites will have been met and you can begin managing Teams through PowerShell. If you are just starting out, then the first thing that I recommend doing is to get a list of the cmdlets that you can use for Teams management. Microsoft lists some of the available cmdlets on its Website (https://docs.microsoft.com/en-us/microsoftteams/teams-powershell-managing-teams), but there is a way to get PowerShell to show you the cmdlets that you can use.

As you will recall, one of the first things that we did in preparing to manage Teams through PowerShell was to load the MicrosoftTeams module. In PowerShell, a module is really just a collection of functions. In PowerShell, every function has a name. When a function is a part of a module, then the function’s name is treated as a cmdlet so long as the module has been loaded. This means that if you want to see a list of the cmdlets that can be used to manage Microsoft Teams then all you have to do is to query the MicrosoftTeams module. You can do so by entering the following command:

Get-Command -Module MicrosoftTeams


There are a huge number of cmdlets in the MicrosoftTeams module.

As you can see in the figure above, there are a huge number of cmdlets that are built into the MicrosoftTeams module. If you are curious as to how many cmdlets are actually included, just enter this command:

Get-Command -Module MicrosoftTeams | Measure

As of the time that this article was written, there were 579 cmdlets in the module. This of course, raises the question of how you can cut through the clutter and find the cmdlets that will actually benefit you?

PowerShell cmdlets are made up of verb-noun combinations. For example, the cmdlet used to create a new team is New-Team. In this case, New is the verb and Team is the noun. The thing about PowerShell is that verbs and nouns are rarely unique. Whereas the New verb can be used to create a new team, it can also be used to create other items such as meeting policies (via the New-CsTeamsMeetingPolicy cmdlet). Because verbs and nouns tend to be reused so frequently, one of the easiest ways to get started with the MicrosoftTeams module is to get a list of the verbs and nouns that can be used when managing Teams.

This command shows you all of the cmdlets included in the MicrosoftTeams module, but groups those cmdlets by verb.

Get-Command -Module MicrosoftTeams | Sort-Object -Property Verb | Format-Table -GroupBy Verb

You can see a portion of the command’s output in the figure below. The figure shows the cmdlets associated with the verbs Export, Find, and Get.


You can group cmdlets by verb.

As an alternative, you can also group cmdlets by noun. The command used for doing so is:

Get-Command -Module MicrosoftTeams | Sort-Object -Property Noun | Format-Table -GroupBy Noun

In the figure below for example, you can see that the cmdlets that work with the noun Team include New-Team, Remove-Team, Get-Team, and Set-Team.

You can group cmdlets by noun.

So now that I have shown you how to narrow down the list of cmdlets, how do you use them? One option is to simply perform a Web search for the cmdlet that you are interested in. Microsoft provides a dedicated page for each cmdlet. If you need to use the New-Team cmdlet for example, you can find its syntax at https://docs.microsoft.com/en-us/powershell/module/teams/new-team?view=teams-ps

Another option is to enter the Get-Help cmdlet, followed by the name of the cmdlet that you are interested in. If you wanted to know how to use the New-Team cmdlet for example, you could type:

Get-Help New-Team

Entering this command causes PowerShell to display the syntax for the New-Team cmdlet. You can see what this looks like in the figure below:


You can use the Get-Help cmdlet to get the syntax of any other cmdlet.

As you can see, Microsoft provides extensive support for managing Teams through PowerShell. The real trick to being able to effectively manage Teams using PowerShell is to figure out which cmdlets are available to you and which are best suited to the task that you are trying to perform.

About The Author

Leave a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top