Hello everyone, this is the first of many articles I hope to post about managing Microsoft 365 using PowerShell. In this first article, I want to show you how to perform basic administration tasks in Microsoft Teams using PowerShell.

Important:

  • You must use your Teams administrator account to perform these steps.

PowerShell Workaround

First, you need to make sure the MicrosoftTeams module is installed on your computer and then imported into your Powershell session. To do that, you should use the following commands.

Once you have imported the module, you are ready to start.

Connect to Microsoft Teams

The easiest way to get started is to log in interactively at the command line.

Creates a new Team

The New-Team cmdlet creates a new team to use in Microsoft Teams and will provide a unified O365 group to support the team.

You can create teams as public, private, or org-wide. For public teams, Anyone using Teams in your organization can join. For private teams, team owners manage team membership. And for an org-wide team, all members of your organization are automatically added.

Get existing Teams

To retrieve all teams in the organization, you should use the Get-Team cmdlet. You can use the following parameters to retrieve teams with particular properties.

Update Team properties

If you want to update the properties of a team, you should use the Set-Team cmdlet with the following syntax.

Microsoft Teams PowerShell

Create a new channel for a Team

Once the Team is deployed, you can create a channel for that team; To do this, you should use the New-TeamChannel cmdlet with the following syntax.

Update Team channel settings

If you want to update the properties of a channel, you should use the Set-TeamChannel cmdlet with the following syntax.

Microsoft Teams PowerShell

To obtain the information about a team channel, you should use the Get-TeamChannel cmdlet.

Delete a Team channel

Deleting a channel in teams using PowerShell should be done using the Remove-TeamChannel cmdlet with the following syntax.

Get the members of a Team

You can use the  Get-TeamUser cmdlet to get the list of team members. Using the -role parameter, you can filter the owners\members of the team.

Add members to the Team

You can add members or owners to the team using the Add-TeamUser cmdlet with the following syntax.

Remove members from a Team

If you’re a team owner, you can remove someone from your team. To do this, you should use the Remove-TeamUser cmdlet with the following syntax.

Deletes a Team from Microsoft Team

Finally, if you want to remove the team, you should use the cmdlet with the following syntax.

Thanks for reading my post. I hope you find it helpful.

If you want to learn more about the Microsoft Teams PowerShell module, check out this link.