Top 10 PowerShell Cmdlets to Manage Microsoft Teams using PowerShell 

Top 10 PowerShell Cmdlets to Manage Microsoft Teams using PowerShell

Microsoft Teams helps people in the organization to communicate and share files with people inside and outside the organization. Microsoft Teams usage has increased a lot in this remote situation. It results in the demand of managing Microsoft Teams by Administrators. Admins can either use Teams admin center or PowerShell to manage their Teams environment. But most admins prefer PowerShell due to its flexibility and operation speed. If you are new to PowerShell or Office 365, it is really challenging to identify the right cmdlet.

So, we are here to help you. This blog lists the top 10 cmdlets to manage the Microsoft Teams environment using PowerShell. Before using the Teams PowerShell cmdlets, you must install and connect to Microsoft Teams PowerShell module.

You must be either a global administrator or Teams administrator to run the below Teams PowerShell cmdlets.

Create and Manage Teams using PowerShell:

You can create a new team using the New-Team cmdlet. For example,

New-Team –DisplayName <TeamName>  

When you create a team, it automatically creates Office 365 unified group, SharePoint site, and Planner in the backend.

To get a list of teams in your organization, you can use the ‘Get-Team’ cmdlet.

get all teams

To change settings in teams, run the ‘Set-Team’ cmdlet with the properties to be updated.

Set-Team -GroupId <TeamId> -Description "Teams description updated" -Visibility "Public"  

In the above example, the team’s description and visibility are updated.

Add Members to Team:

To add users to a specific team, use the ‘Add-TeamUser’ cmdlet as shown below.

Add-TeamUser -GroupId <TeamId> -User <UPN>  

If you want to add a user as an owner, run the above cmdlet along with the ‘Role’ parameter.

Add-TeamUser -GroupId <TeamId> -User <UPN> -Role Owner  

Remove Users from Teams:

To remove an owner or member from a team, you can use the ‘Remove-TeamUser’ cmdlet.

To remove a member from the team, run the following cmdlet.

Remove-TeamUser –GroupId <team’s groupid> -User <MemberUPN>  

When you want to remove the owner from a group, first change their role from owner to member, then remove them. Because when you remove the owner from a team, they will stay as a member. For example,

To remove John, who is the owner of a Project Team, run the following script.

Remove-TeamUser –GroupId <ProjectTeam’s id> -User [email protected] -Role Owner #Removed from owner role in Project Team.  
Remove-TeamUser –GroupId <ProjectTeam’s id> -User [email protected] #Removed from Project Team 

The first example will remove the user from owner role in Project Team and second example remove the user from Project Team.

To get a report on teams, channels, and their members/owners, you can download the Teams reporting using PowerShell script from o365reports.com.

Create Channel in Teams:

After creating a team, you can create channels under that team using the ‘New-TeamChannel cmdlet using the following syntax.

New-TeamChannel -GroupId <Team’s groupid> -DisplayName <ChannelName>  

The above format creates a standard channel. To create a private channel, run the above code with the ‘MembershipType’ parameter.

For example,

New-TeamChannel -GroupId 126b90a5-e65a-4fef-98e3-d9b49f4acf12 -DisplayName "Confidential" -MembershipType Private  

This example creates a private channel called ‘Confidential’.

Add Members to Teams Private Channel:

For adding members or owners to a private channel, you can use the ‘Add-TeamChannelUser’ cmdlet. To add a user as a member, run the following code.

Add-TeamChannelUser –GroupId <TeamId> -DisplayName <PrivateChannelName> -User <UPN>  

To promote a user as owner, execute the below cmdlet.

Add-TeamChannelUser –GroupId <TeamId> -DisplayName <PrivateChannelName> -User <UPN> -Role <Owner> 

Remove Members from Private Channel:

You can use the ‘Remove-TeamChannelUser’ cmdlet to remove a user from the private channel or demote the existing owner into a member. When you want to remove the owners from a private channel, you first demote them to members, then remove them.

To demote an owner to a member, run the following cmdlet.

Remove-TeamChannelUser –GroupId <team’s groupid> -User <OwnerUPN> -Role Owner  

To remove a member from the private channel, execute the below code.

Remove-TeamChannelUser –GroupId <team’s groupid> -User <MemberUPN> 

Download the private channel reporting script to know about the private channels in your organization and their membership details.

Archive Team:

When a team is no longer active but wants to keep the content accessible, you can archive it using the ‘Set-TeamArchivedState’. You can also reactivate the archived teams if needed.

To archive a specific team,

Set-TeamArchivedState –GroupId <Team id> -Archived $true  

Like archiving teams, you can also archive channels in Microsoft Teams.


To unarchive a team, run the Set-TeamArchivedState cmdlet with Archived as False. For example,

Set-TeamArchivedState –GroupId <Team id> -Archived $false  

You can refer the manage archives in teams blog to know more about archiving teams in bulk and retrieving all the archived teams.

Delete Teams and Channels:

To delete a team, run the ‘Remove-Team’ cmdlet with the team’s groupid as shown below.

Remove-Team –GroupId <team’s groupid>  

To delete a channel in a team, run the ‘Remove-TeamChannel’ cmdlet with team identity and channel name.

Remove-TeamChannel –GroupId <team’s groupid> - DisplayName <ChannelName>  

Thus, we have explored the PowerShell cmdlets to level up the Microsoft Teams management in your Microsoft 365 environment. 📌

Do you fix this as the best and most efficient way to take control of Teams environment? 🤷

Not at all! Let’s dive into the cost-efficient yet useful Microsoft Teams reporting tool in the game!

AdminDroid – A Path to Streamlined Microsoft Teams Management!

Besides PowerShell cmdlets, AdminDroid provides 100+ real-time Teams reports 📑 to keep you up to date with all the vital information to manage your Microsoft Teams environment. With these reports, you can effortlessly monitor the teams’ details, team members, apps & tabs, teams call analytics, meeting statistics, etc., and stay informed about the overall health of your Teams environment.

Moreover, AdminDroid Teams audit reports 🔍 help you to efficiently track all the activities, such as teams’ logins, setting changes, team membership changes, ownership promotions, etc.

The icing on the cake! An exclusive Microsoft Teams Dashboard 📊optimizes your time by providing a holistic view of Teams without requiring you to rely on PS scripts.

Microsoft Teams Dashboard

Keep your Teams management ahead of the curve and stay informed of every development in your Teams environment with AdminDroid.

Download the AdminDroid Teams Management tool 💡now and unlock the 15 days of free trial! Experience the full potential of AdminDroid and explore its premium capabilities at no cost during this trial period. 📍

I hope this blog will be handy in managing the Microsoft Teams Environment using the command line. Isn’t it helpful? Share your thoughts in the comment section.

Top 10 PowerShell Cmdlets to Manage Microsoft Teams using PowerShell 

by Kathy time to read: 5 min
0