Skip to content

Manage Microsoft Teams with PowerShell

Manage Microsoft Teams with PowerShell

Hello everybody, we all know that Microsoft Teams that has millions of active users daily has its Admin Center. So do we have the capabilities that we have on the admin center with Powershell that makes IT personnel’s job easier? The answer, for sure, is yes. 🙂 Even if we want to import the list of existing channels or make changes on policies, we can. I will be sharing Powershell cmtlets of the mostly used actions and some Powershell outputs. In addition to what I share, you can access Powershell cmtlet list published by Microsoft through this link. 

Connecting to Microsoft Teams with Powershell   

We need to connect to Teams via PS first to be able to run actions on Powershell just like in Exchange Online. But first we need to install the Microsoft Teams module on PS or if it is installed, we need to import it. I will accept it as not installed for you and share both versions below. 

1. Install-Module MicrosoftTeams

2.Import-Module MicrosoftTeams


4.Connect-MicrosoftTeams -Credential $credentials

Teams Login PSAs you can see in the image above, now we are connected to Microsoft Teams with Powershell 

Most Frequently Used Cmtlets for Microsoft Teams on Powershell 

Cmtlet To Find Out Current Team List :


Cmtlet to Find Out the List of users in Microsoft Team : Get-TeamUser -GroupId 2f162b0e-36d2-4e15-8ba3-ba229cecdccf

Cmtlet to See the Owners in the existing Team : Get-TeamUser -GroupId 2f162b0e-36d2-4e15-8ba3-ba229cecdccf -Role Owner


Cmtlet to Add a User to the Team on Microsoft Teams : Add-TeamUser -GroupId 31f1ff6c-d48c-4f8a-b2e1-abca7fd399df -User [email protected]

Cmtlet to Remove a User from the Team on Microsoft Teams : Remove-TeamUser -GroupId 31f1ff6c-d48c-4f8a-b2e1-abca7fd399df -User [email protected]

Cmtlet to Add a User to Private Channel on Microsoft Teams : Add-TeamChannelUser -GroupId 31f1ff6c-d48c-4f8a-b2e1-abca7fd399df -DisplayName “Engineering” -User [email protected]

Cmtlet to Remove a User from a Private Channel on Microsoft Teams :Remove-TeamChannelUser -GroupId 31f1ff6c-d48c-4f8a-b2e1-abca7fd399df -DisplayName “Engineering” -User [email protected]

Cmtlet to Remove a Team on Microsoft Teams : Remove-Team -GroupId 31f1ff6c-d48c-4f8a-b2e1-abca7fd399df


Even though the actions we run on Powershell save us time compared to GUI, the changes we make are going to take some time to be displayed on the system and always keep in mind that Powershell doesn’t afford mistakes. It is important to check the cmtlets that we haven’t tested or we are not sure 3 times before we run them.  

I hope that this was helpful for you. 

You can click here to read our article about the effects of severe paper usage in offices on deforestation.