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
Connect-MicrosoftTeams
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.
Get-Team

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 f.huber@sid-500.com -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 'f.huber@sid-500.com'
Fine. That’s it for today. See you next time with Teams.
Categories: Microsoft 365, PowerShell
Obwohl ich mich mit dieser Thematik nicht so gut auskenne, wie vermutlich andere Leuten die eurem Blog hier verfolgen wurde ich euch nur kurz loben und sagen das Sie weiter so machen. Das kann man auch hier an Kommentaren sehen. Viele Leute bedanken sich und geben euch eine große Unterstützung.
LikeLiked by 1 person
Vielen Dank!
LikeLike
Patrick, thank you for the post, it helps me to get started! When I run the command get-team, PS sort of enters a never ending job. It doesn’t return any teams.
I work from a Mac, using Visual Studio Code, PowerShell 7.1. That module should work cross-platform.
The Connect-Team works, so I get connected to a tenant.
Do you have any idea what is wrong?
LikeLike
It could take some time to get all teams depending on your environment.
LikeLike
Great article, thank you so much
LikeLiked by 1 person
Thank you!
LikeLike
Hooray hooray, great article. Thank you very much.
LikeLiked by 1 person