Skip to content


Folders and files

Last commit message
Last commit date

Latest commit



26 Commits

Repository files navigation


PowerShell script to add users to teams or to private team channels in Microsoft Teams using a CSV file. Users are added using their email address.

You can install the script by downloading the script from this github page or by installing it directly from the PowerShell Gallery:

Installation instructions for Windows

Download and install PowerShell from

Start PowerShell from the Start Menu and install MicrosoftTeams module

Install-Module -Name MicrosoftTeams -RequiredVersion 1.1.10-preview -AllowPrerelease

Install Add-UsersToTeamsFromCSVFile script

Install-Script -Name Add-UsersToTeamsFromCSVFile

Installation instructions for macOS

Install PowerShell using brew in the Terminal App.

brew install powershell

Start PowerShell in Terminal


Install MicrosoftTeams and Script

Install-Module -Name MicrosoftTeams -RequiredVersion 1.1.10-preview -AllowPrerelease
Install-Script -Name Add-UsersToTeamsFromCSVFile

Get location of PowerShell gallery scripts.

Get-InstalledScript -Name "Add-UsersToTeamsFromCSVFile" | Format-List InstalledLocation

Due to PowerShell bug on macOS you need to add the installed script location /Users/[YOUR_USERNAME]/.local/share/powershell/Scripts/ to the path so that the PowerShell can find the installed scripts.

$env:PATH += ":/Users/[YOUR_USERNAME]/.local/share/powershell/Scripts/"

Check that module and script are installed

Get-Module -ListAvailable

Show Help

help Add-UsersToTeamsFromCSVFile.ps1

Update script to latest version

Update-Script Add-UsersToTeamsFromCSVFile

CSV file

The script requires a CSV file. This file should contain a header with the names of the columns. To add users to a team, the CSV file needs to have the columns 'email' and 'team'.

email,team,Module1 Team,Module1 Team,Module2 Team,Module2 Team

To add users to a private channel in a team, the CSV file needs to have the columns 'email', 'team', and 'privatechannel'. If a user is not a member of the team they will be added to the team first and then to the private channel within the team.

email,team,privatechannel,Seminar Group,Channel1,Seminar Group,Channel1,Seminar Group,Channel2,Seminar Group,Channel2

Please note that if the team or private channel name contains a comma or quotes your need to use quotes around the name. For example, the team name Seminar's team, 1 should have quotes around the name in the csv file: "Seminar's team, 1". If you use Excel to create a CSV file and save the file as CSV, Excel will automatically add the quotes.


# First connect to Microsoft Teams (AzureCloud)

# run script
Add-UsersToTeamsFromCSVFile.ps1 students.csv


Script to add users to teams or to private team channels in Microsoft Teams using a CSV file