Skip to content

pcourbin-teaching/msteams_add_users

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Add Users to Microsoft Teams Group - Usage Guide

Prerequisites

  • 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 -Force

Connect to Teams

Note: Launch PowerShell as Administrator to ensure you have the necessary permissions.

Connect-MicrosoftTeams

If you get a permission error, run:

Set-ExecutionPolicy RemoteSigned

Prepare Your CSV File

Create 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 mail column contains the user's email.
  • The channels column 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

Script Usage

Note: Launch PowerShell as Administrator to ensure you have the necessary permissions.

  1. Make sure your CSV file is in the same folder as add-users.ps1.
  2. Open PowerShell in this folder.
  3. 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 createChannelsIfNotExist parameter to $false.

How to Find Your Team ID

List your Teams groups:

Get-Team

Or filter by name:

Get-Team | Where-Object { $_.DisplayName -like "*YourTeamName*" }

Need Help?

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors