Microsoft 365

MS-Teams: Create and configure Teams with PowerShell

What is one of the most used tools these days? It is – by all means – MS-Teams. In this blog post I will show you how to connect to MS-Teams and how to create a Team with PowerShell. I will also do some other stuff, too. Let’s jump in.

Install the MS-Teams Module

First we need to install a PowerShell module called Microsoft Teams.

Install-Module MicrosoftTeams

Now let’s connect to MS-Teams


Finally let’s check if the newly imported MS-Teams commands are present.

Get-Command -Module MicrosoftTeams

That looks good.

Retrieve all Teams

Get-Team is the cmdlet we need to use when we want to list all teams.


To list only one team run Get-Team with the -GroupId parameter or use a filter to filter out the group based on the displayname.

Get-Team -GroupId 4d530d96-c1b6-4e64-9386-93b050c40e7e

Get-Team | Where-Object DisplayName -like '*sid-500*'

Create a Team

New-Team is the command we need if you we want to create a new team.

New-Team -DisplayName TestTeam -Owner -Visibility Public

Create multiple Teams at once

If you know me, then you know what comes next. Automation. The command below creates Team1 – Team 5.

1..5 | ForEach-Object -Process {New-Team -DisplayName Team$_}

Cool stuff.

Add Team Members

You now might wonder whether we have skipped something. You are right. We need to add team members.

In order to do this we need to retrieve the teams group id.

Get-Team | Select-Object -Property DisplayName,GroupId

Now that we have discovered the Groupid, we are able to add team members.

Add-TeamUser -GroupId 665e8b48-1b62-4c7a-95fa-4517135bd95c -User ''

Fine. That’s it for today. See you next time with Teams.

3 replies »

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.