2.0 KiB
2.0 KiB
Import-TeamsUsers
A Powershell script that imports users from a CSV into a Microsoft Teams team.
Setting up your device
This script runs via PowerShell. If you're on Windows, you'll already have this. If not, please download it from the releases page. Once you've got PowerShell:
- Open PowerShell.
- Allow remote scripts to execute by running
Set-ExecutionPolicy RemoteSigned. If you don't do this, the script won't run. - Install the Microsoft Teams module. To do this, run
Install-Module -Name MicrosoftTeams. Accept any prompts that you are given.
Gathering information
You'll need to do a few things before you can run the script:
- Have a CSV file with the users you want to add. This needs to be in the format
email,role. You can copy the template if required. - Import the Microsoft Teams module. Run
Import-Module -Name MicrosoftTeamsin your Powershell terminal. - Authenticate to Microsoft Teams. Run
Connect-MicrosoftTeamsin your Powershell terminal and follow the instructions. - Get your group ID. Run
Get-Team -User <EMAIL>, substituting<EMAIL>for your Office 365 email address, to list all teams you are a member of.
Running the script
- Copy or move the CSV file to the same folder that the
Import-TeamsUsers.ps1file is in. - Open the
Import-TeamsUsers.ps1file. - Modify the
$GroupIdvariable to the Group ID you found from step 4 in the section above. - Modify the
$Filevariables to the name of your CSV file. - Run the script.
Need help?
If you require assistance running the script, please send me an email.
Issues? Want a new feature?
If you're having problems with the script or have an idea for a new feature, please check here to see if someone else is having the same problem, and open an issue if one doesn't already exist. If you can implement a fix or feature request, please file a pull request!