Creating a New Team using PowerShell

In a recent article on this site, I explained that PowerShell is a better overall tool for the bulk management of Microsoft Teams then the GUI is. While the GUI interface does work, it really doesn’t scale very well for large jobs. In that particular article, I explained how to install the necessary PowerShell modules and connect PowerShell to Microsoft Teams. I even talked about how to find the command lets the could be used to perform various PowerShell related tasks. After writing that article however, I was left with the feeling that maybe I could have done more. As such, I wanted to revisit the topic and walk you through the process of creating a new team using PowerShell.

Before I Begin

Before I get started, I just want to quickly point out that this article assumes that you know how to access your Microsoft Teams environment from PowerShell. If you need help connecting to Microsoft Teams, then check out my previously mentioned article or the Microsoft documentation located at: https://docs.microsoft.com/en-us/microsoftteams/teams-powershell-managing-teams

Creating a New Team

You can use PowerShell to create a new team by using the New-Team cmdlet. In doing so, you will need to provide a name for the team that you are creating. This is done through the DisplayName parameter. It’s also a good idea to provide a description for every new team that you create. You can use the Description parameter to create the description. Here is what the full command looks like:

New-Team -DisplayName “Example” -Description “This is an example team that was used to demonstrate the process of creating a team through PowerShell”

You can see what this looks like in the figure below.


I created a new team in PowerShell.

As you look at the figure above, you will notice that the new team’s visibility is set to Private. However, let’s pretend that for whatever reason, we need this particular team to be public. You can use the Set-Team cmdlet to change a team’s visibility. You can also use the Set-Team cmdlet to change any other team attributes that you might want to modify.

You can use the Set-Team cmdlet by itself (by referencing the team through its GroupID), but it is often easier to use the Get-Team cmdlet to retrieve a team and then use the Set-Team to make the desired modification.

If you enter the Get-Team cmdlet by itself, you will get a list of all of the teams in the organization. However, if you enter the Get-Team cmdlet, followed by the DisplayName parameter and the name of the team, you can retrieve just that team. You can see what this looks like below.


You can use the Get-Team cmdlet to retrieve a team.
The trick to setting the team’s visibility is to pipe the Get-Team cmdlet’s output into the Set-Team cmdlet and then specify the desired visibility. Here is an example of what the command looks like:

Get-Team -DisplayName “Example” | Set-Team -Visibility “Public”

If you look at the figure below, you can see that I have set the team’s visibility to public and then I changed it back to Private.


This is how you change a team’s visibility.

Another thing that you can do through PowerShell is to create one or more channels within a team. The cmdlet that is used to create new channels is New-TeamChannel.

There are two different ways that you can create a channel within a team. The first option is to use a technique that is nearly identical to what I just showed you. Just use the Get-Team cmdlet to retrieve the team and then pipe the Get-Team cmdlet’s output into the New-TeamChannel cmdlet.

The other option is to include the team’s GroupID within the New-TeamChannel cmdlet. Incidentally, you don’t have to type the GroupID. When you enter the Get-Team cmdlet, the team’s GroupID is displayed. You can use your mouse to select this number and then press Ctrl+C to copy it to the clipboard. You can then begin typing the Net-TeamChannel command and press Ctrl+V to paste the GroupID into the command.

So with that said, let’s create two new channels within the Example team that I created earlier. I will use both creation methods. Here are the commands:

Get-Team -DisplayName “Example” | New-TeamChannel -DisplayName ”Channel1”
New-TeamChannel -GroupID 84871e15-4f7f-4fb6-bf9d-d0c4bca021fb -DisplayName “Channel2”

Incidentally, you can also append the MembershipType parameter to make a channel public or private. Here is what the channel creation process looks like:


I have created two new channels and then used the Get-TeamChannel cmdlet to display a list of the team’s channels.

Once you have created a new team and some channels, you may want to begin adding some users to the team. The cmdlet used for doing so is Add-TeamUser. Normally, when you use this cmdlet, you will need to supply the GroupID parameter and the User parameter (the username is specified as an email address). However, you can use the Get-Team cmdlet in leu of entering the GroupID, just as we have done before. So with that said, here is how I can add my own account to the Example team that I have created:

Add-TeamUser -GroupID 84871e15-4f7f-4fb6-bf9d-d0c4bca021fb -User [email protected]

This is how you add a user to a team.

So as you can see, it is relatively easy to use PowerShell to create and provision new teams. Being that the team that I created was an example team however, I thought that I would end this article by showing you how to remove an unwanted team. As you may have guessed, the cmdlet used for deleting a team is Remove-Team. The only parameter required by this cmdlet is the GroupID. So if I wanted to delete my example team, the command would look like this:

Remove-Team -GroupID 84871e15-4f7f-4fb6-bf9d-d0c4bca021fb

You have to be careful using this particular cmdlet, because as you can see in the figure below, PowerShell does not ask for confirmation when deleting a team.


I have deleted the example team.

Leave a Comment

Your email address will not be published.

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

Scroll to Top