Add Multiple Users to a Microsoft Teams Team Using PowerShell

In this blog post, I will show you how to add multiple users to an existing Microsoft Teams Team using a CSV file and PowerShell.

There is no doubt that PowerShell and CSV make our life extremely easy when it comes to Office 365 management.

This example will show how handy it is to use PowerShell for MS Teams management.

CSV

Below, you can see the CSV file template that I’m using.

The template contains the email addresses and the column name, which in my case is called upn.

upn

Email1@domainname.co

Email2@domainname.co

Install Teams PowerShell Module

To install the Microsoft Teams PowerShell module, I will use the following command.

Install-module microsoftteams

Connect To MS Teams

To connect to Microsoft Teams using PowerShell I will run the following command.

Connect-microsoftteams

Add Users

Before I can run my script and add users from the CSV file I need to find the Group ID of the MS Teams Team I would like to add the users to.

To check the Group ID of my Team, I will run the following command and copy the Team’s GroupID value.

Get-Team | select groupid, display*

To add the users to my MS Teams Team, I will run the following command using the copied GROUPID value.

Import-Csv -Path "users.csv" | foreach{Add-TeamUser -GroupId GROUPID -user $_.upn}

Check Members

To check if the command was successful, I will then run the following command with the GROUPID

Get-TeamUser -GroupId GROUPID | select user

More Articles From The MS Teams Series:

Disable MS Teams Background, Blur and Effects

Delete Multiple Microsoft Teams, Teams PowerShell

Delete Multiple Microsoft Teams Channels PowerShell

Create Multiple Microsoft Teams, Teams Using PowerShell

Get List Of Microsoft Teams Channels PowerShell

Get a List of all Microsoft Teams, Teams Using PowerShell

Install Microsoft Teams PowerShell Module

Processing…
Success! You're on the list.

Posted

in

by

Comments

One response to “Add Multiple Users to a Microsoft Teams Team Using PowerShell”

  1. alice Avatar
    alice

    Hi!
    Thank you for sharing the useful information. Will you teach how to add multiple users to channel?