Saturday , April 4 2020

Microsoft Teams PowerShell

Poweshell is simply amazing , it saved more than 3000 hours in my life. It made the impossible possible to work with Microsoft Products seamlessly. when it comes to managing large data sets or user base. It makes life simply easy. Microsoft Teams dynamic membership can happen only on the team level with Azure P1 license . But if you wish to have channels with large user base. PowerShell is your savior.  Otherwise your fingers are going to pain clicking it.  i have made as simple as possible using the existing cmdlets . if you wish to add any additional cmdlets please feel free to leave on comments.

Installing Teams Module

Find-Module MicrosoftTeams
Find-Module MicrosoftTeams | Install-Module


Using Pre-Release Modules _ For Example Some Commands Available are only at pre-release

Register-PSRepository –Name '_TempTestRepo' –SourceLocation ''
Get-PSRepository | Fl
Install-Module MicrosoftTeams –RequiredVersion 1.0.20


Production Versions –

Pre-Release Versions –



To List all Teams



To Get Channels within Team

Get-Team -DisplayName "Information Technology" | Get-TeamChannel


1. Copy Channel Members to another Channel

You can collect the GroupID of the team from the previous command

Get-TeamChannelUser -GroupId "50e33be9-GROUPIDOFTHETEAM4706544ab1a4"  -DisplayName "ChannelName"

Now Save it to a Variable from Channel1

$SaveAllMembers  = Get-TeamChannelUser -GroupId "50e33be9-GROUPIDOFTHETEAM4706544ab1a4"  -DisplayName "ChannelName"


Now Add Same Set of Members to Channel2

$saveallmembers | ForEach-Object{Add-TeamChannelUser -GroupId "50e33be9GROUPIDOFTHETEAM706544ab1a4" -DisplayName "CHANNEL NAME" -User $_.user}


Removing Specific Channel user

Remove-TeamChannelUser -GroupId "50e33be9GROUPIDOFTHETEAM-4706544ab1a4" -DisplayName "Channel name" –User “”


Export Channel Members to CSV –

Get-TeamChannelUser -GroupId "50e33be9GROUPIDOFTHETEAM-4706544ab1a4" -DisplayName "Channel Name" | Select-Object User | Export-Csv TeamsChannelMembers.csv


Removing Members from Channels using CSV

Import-Csv .\TeamsChannelMembers.csv
Import-Csv .\TeamsChannelMembers.csv | ForEach-Object{Remove-TeamChannelUser -GroupId "50e33be9-GROUPIDOFTHETEAM-4706544ab1a4" -DisplayName "SD - NET" -User $_.User}


Adding Channel Members using CSV

Import-Csv .\TeamsChannelMembers.csv | ForEach-Object{Add-TeamChannelUser -GroupId "50e33be9GROUPIDOFTHETEAM-4706544ab1a4" -DisplayName "Channel Name" -User $_.User}

Adding Team Members using CSV

Import-Csv .\TeamsMembers.csv | ForEach-Object{Add-TeamUser -GroupId "000faf41-7fa8-0000-ac2d-2c180000af77" -User $_.User}}

About Satheshwaran Manoharan

Satheshwaran Manoharan is an Microsoft Office Server and Services MVP , Publisher of Specialized in Office365 / Microsoft Exchange / Virtualization , Sathesh is an Messaging Expert supporting/Designing/Deploying many medium size businesses to large enterprises when it comes to Corporate messaging and Virtualization Infrastructure

Check Also

Some Mails Getting Converted to Chinese Characters

Some Emails in Outlook 2016 will Convert to Chinese Characters after reading some after archiving …

Leave a Reply

Your email address will not be published.