Lately, I had to add around 1,000 users to a Microsoft Teams at once, and after that, on a second wave, I had to refresh it with another bunch of users.

As I didn’t want to lose my finger on the attempt putting them one by one, I appealed PowerShell to come to the rescue…:-) here it is:

Adding users massively

Create and add users to a Distribution List

After Distribution List created, I made “users.csv” file:


And then, I easily add all users with this snipped PowerShell code:

Import-Module ActiveDirectory

$teamGroup = "Example-DL"

Import-Csv ".\users.csv" | foreach {
    Add-ADGroupMember -Identity $teamGroup -Members $_.login
    Write-Host $_.login

To check everything was as expected, I run following line to see total number of users:

(Get-ADGroupMember -Identity Example-DL).count

After replication time passed to refresh changes in Office 365, I connected to Microsoft Online and check again number of users from this perspective; it will be what Microsoft Teams will only see:

(Get-DistributionGroupMember -Identity

Add Distribution List users to the Team

I went to Microsoft Teams, clicked on the Team Name, and got access to the following screen:

Clicked on “Add member” button, and got access to the next dialog, putting the corresponding Distributed List created previously. Only a few moment to reprocess objects, and finally it is done!

Refreshing members list

Simply had to update previously Distributed List, adding or removing users, and after that, repeat again the previous step; again using the same Distributed List.

Microsoft Teams will recognize already subscribed users and will add new ones only:


Leave a Reply

%d bloggers like this: