Last active
April 12, 2021 19:04
-
-
Save marc-hanheide/2ef8f18c8cd9e7aafa0f38962241a849 to your computer and use it in GitHub Desktop.
Tricks for interacting with MS Teams using PowerShell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First get powershell (also available for Mac) ;-) | |
# Install Teams module in powershell (once) | |
Install-Module -Name MicrosoftTeams | |
# Connect to Teams | |
Connect-MicrosoftTeams | |
# Find the Team (can take a while): | |
Get-Team -DisplayName "UoL-SAGA Code camp 2021" | |
# using the GroupId found above run the sub commands (see e.g. https://docs.microsoft.com/en-us/powershell/module/teams/get-teamuser?view=teams-ps): | |
# get all users of a team | |
Get-TeamUser -GroupId e3f550aa-3de4-4df0-becf-e35c899d155c | |
# get all channels of the team | |
Get-TeamChannel -GroupId e3f550aa-3de4-4df0-becf-e35c899d155c | |
# bulk add users to a team (see https://joguerre.medium.com/adding-bulk-users-from-a-csv-file-to-a-microsoft-teams-team-374414b9d8c9): | |
Import-Csv -Path "YOUR_FILE_PATH" | foreach{Add-TeamUser -GroupId YOUR_TEAM_ID -user $_.email} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment