Last active
April 25, 2021 00:26
-
-
Save patrick138/83ba1745cf162e5e75437ab844fb6783 to your computer and use it in GitHub Desktop.
Add users from text file or csv to a Microsoft Teams site
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Adding multiple users to teams by PowerShell and a text / CSV file | |
1) Create a .txt file like this | |
Name | |
[email protected] | |
[email protected] | |
2) Install the Teams PowerShell tools: | |
Install-Module -Name MicrosoftTeams | |
-RequiredVersion 0.9.0 | |
3) Find the GroupId | |
PS get-team | |
4) Run this script | |
Import-Csv 'd:\email.txt' | % { | |
Add-TeamUser -User $_.Name -GroupId <GroupID> | |
} | |
It takes about 30 minutes or more before you see the updates users in Teams. Also an error will be displayed for all users that are alreay present. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$path='d:\email.txt' | |
$GroupId=<groupid> | |
Import-Csv $path | % { | |
Add-TeamUser -User $_.Name -GroupId $GroupId | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's another post I found which might be a solution if you edit the role column in CSV file:
https://flexmind.co/blog/how-to-add-bulk-users-from-csv-file-to-ms-teams-using-powershell/