- You must have admin rights on Microsoft Teams or Azure AD.
- Install the PowerShell module for Teams:
Note: Launch PowerShell as Administrator to ensure you have the necessary permissions.
Install-Module -Name PowerShellGet -Force -AllowClobber
Install-Module -Name MicrosoftTeams -ForceNote: Launch PowerShell as Administrator to ensure you have the necessary permissions.
Connect-MicrosoftTeamsIf you get a permission error, run:
Set-ExecutionPolicy RemoteSignedCreate a CSV file (e.g., add-users.csv) with the following format:
mail,channels
user1@example.com,General
user2@example.com,"'General','PrivateChannel1'"
user3@example.com,
- The
mailcolumn contains the user's email. - The
channelscolumn contains a comma-separated list (with quotes), to add the user to (leave empty to add only to the Team).
Alternatively, you can add the same user to multiple channels by listing them in separate rows:
mail,channels
user4@example.com,General
user4@example.com,PrivateChannel2
user4@example.com,PrivateChannel3
Note: Launch PowerShell as Administrator to ensure you have the necessary permissions.
- Make sure your CSV file is in the same folder as
add-users.ps1. - Open PowerShell in this folder.
- Run the script:
.\add-users.ps1
The script will:
- Load the emails from your CSV file.
- Ask for the Team ID (or you can set it directly in the script for faster execution).
- Add each user to the specified Microsoft Teams group.
- Create private channels if they don't exist. This behavior can be disabled by setting the
createChannelsIfNotExistparameter to$false.
List your Teams groups:
Get-TeamOr filter by name:
Get-Team | Where-Object { $_.DisplayName -like "*YourTeamName*" }If you want help generating the script for your own CSV or Teams group, send your file or group name and you'll get a ready-to-use script.