How to Add Bulk Users to Microsoft Teams 

How to Add Bulk Users to Microsoft Teams 

Recently I came across multiple technical forums with the same question “How to add bulk members to teams through PowerShell?”. I thought I’d help with this by writing a script. Managing Microsoft Teams using PowerShell is a simple and effective way. So, Let’s dive in. 

 

How to Add Bulk Users to Teams Group using PowerShell: 

The PowerShell cmdlet Add-TeamUser adds a member to the team. But you can’t use it directly for adding members in bulk. So, you need a few lines of PS code to make it work. To use Teams PowerShell cmdlets, you must install Microsoft Teams PowerShell module.   

To bulk import users from CSV file, you can use the following PowerShell script. 

Connect-MicrosoftTeams 
Import-CSV <FilePath> | foreach {   
$UPN=$_.UPN   
Write-Progress -Activity "Adding $UPN to teams..."   
Add-TeamUser –GroupId <TeamId> -User $UPN   
If($?)   
{   
 Write-Host $UPN Successfully added -ForegroundColor Green   
}   
Else   
{   
 Write-Host $UPN - Error occurred –ForegroundColor Red   
}   
} 

In the above script, you can replace the following. 

<FilePath> –>CSV file path
<Team Id> –> Team group id (To view Team id, you can use the Get-Team cmdlet.) 

The input CSV file should follow the format below. 

Add bulk users to Microsoft Teams csv import

The script execution looks similar to the below screenshot. 

Add bulk users to teams

Additional Use cases: 

  • You can also use the above code to add bulk guest and external users to teams by importing external users through input CSV. 
  • If you want to add owners to the team, you can use the same code, additionally with the –Role parameter in the Add-TeamUser cmdlet. For example, 
Add-TeamUser –GroupId <TeamId> -User $UPN –Role Owner 
  • Adding users to teams automatically adds users to teams’ channels. But it will not add users to private channels. 

 

How to View Teams Members and Owners Report: 

Admins can view all the teams and their members through the Team admin center. Viewing via the Teams admin center is suitable only for small organizations. For large organizations, PowerShell is the only solution. 

To make it simple, you can use the pre-built script to generate 8+  Microsoft Teams reports including all teams report, all teams members & owners report, channels report, etc. 

Microsoft Teams Reporting

I hope this blog will help in managing Microsoft Teams efficiently and effortlessly. Happy scripting! 

How to Add Bulk Users to Microsoft Teams 

by Kathy time to read: 1 min
0