PowerShell for Microsoft Teams Owners?



Warning: Your organisation may have locked down this capability but if you work on Microsoft Teams it is still worth knowing that it’s technically possible. If you are an admin and you have not put controls in place, then you may decide to take action.

One of my colleagues recently asked if there was an easy way to move hundreds of users between Teams? He owned both Teams but was not a Microsoft Tenant Admin.

To be totally honest it took me a while to “remember” but it dawned on me that good old PowerShell might be the answer. One of the nice things about the Teams Module is that is does allow Owners to perform actions on their Microsoft Teams. For anyone who is a Microsoft IT Pro what comes next is probably trivial but there are loads of technically minded people out there who are not familiar with PowerShell and who are Microsoft Team owners. This post is aimed at these folks.

I’ve created the short video below that provides the answer to the “moving users” question.

If you are new to the Teams PowerShell module you can get started by reading the documentation.

In case it helps the commands I used in the video are provided below:

Get-TeamUser -GroupId 2a34a55f-7adc-4e6c-9355-a6500f61e44b

Get-TeamUser -GroupId 2a34a55f-7adc-4e6c-9355-a6500f61e44b | Export-CSV -path C:\temp\AppTest.csv

$FilePath = “C:\temp\AppTest.csv”

Import-CSV $FilePath | Add-TeamUser -GroupId 138cc514-2800-4eb3-8725-1f449c896b72

Note: You will need to replace the Team’s GroupIds (ObjectIDs) with your own. If your tenant admin has not switched off access you can to do this by logging onto your Azure Portal (https://portal.azure.com) using your Microsoft 365 credentials and navigating to Groups, which live under Azure AD. The Export-CSV command will create the AppTest.csv file for you.

Hopefully, this has provided some food for thought?