PowerShell ยป Manage users in ms teams

PowerShell scripts for Microsoft 365

How to manage users in Microsoft Teams using PowerShell

The Add-TeamUser cmdlet helps add a user to a team as its member or owner using PowerShell. The user is also added to the Microsoft 365 group that backs up the team.


  1.  Add-TeamUser
  2.   -GroupId <String>]
  3.   -User <String>]
  4.   [-Role <String>]
  5.   [<CommonParameters>]


1 Add-TeamUser -GroupId 31f1ff6c-d48c-4f8a-b2e1-abca7fd399df -User sam@test.com

In this example, the user sam@test.com is added to the team and the specified group.

Cmdlet: Remove-TeamUser

This cmdlet removes a user from a team and its unified group. You can specify the role of the user as 'Member' or 'Owner'. If specified as 'Member', the user is completely removed from the team, even if he or she is a team owner. However if the role is specified as 'Owner' then the user is removed from the owner role but continues as a member of the team.

  1.  Remove-TeamUser
  2.   -GroupId <String>]
  3.   -User <String>]
  4.   [-Role <String>]
  5.   [<CommonParameters>]


1 Remove-TeamUser -GroupId 31f1ff6c-d48c-4f8a-b2e1-abca7fd399df -User sam@test.com -Role Owner

In this example, the user sam@test.com is removed as an owner in the specified team but continues to be a member.

Working with PowerShell scripts can be error-prone as it involves complex scripting. It is also time-consuming as the changes take a while to reflect in the application.Though the command is executed immediately, one might need to keep the Microsoft Teams application open for at least an hour for the changes to be applied. M365 Manager Plus helps to simplify Teams management with its bulk management feature.

How can M365 Manager Plus help?

The user-friendly interface helps you add or remove users to teams in bulk by simply importing a CSV file. You can also create automated workflows in the tool to manage Teams. This will help save time and reduce your workload.

Steps to manage team members in bulk using M365 Manager Plus:

  1. Go to the Management tab.
  2. Navigate to Azure Active Directory > Group Management   in the left pane.
  3. Select Group Member Management > Modify Microsoft 365 Group Members.
  4. Select the groups to which you would like to add or remove members.
  5. Select the required Microsoft 365 Tenant from the drop-down box.
  6. Import the required CSV file.
  7. Click  Import user(s).

You can also team members by running a name search in the Modify Microsoft 365 Group Members task as shown below.

Modify Microsoft 365 Group Members

To know more about managing Microsoft Teams using M365 Manager Plus, click here.