Microsoft Teams PowerShell Report

Matt Ellis
365 UC
Published in
2 min readMar 25, 2019

Updated (24/04/19): Microsoft have just released version 1.0.0 of the PowerShell module which is available here. This new module only uses 1.0 Graph APIs and Get-Team has been improved with the ability to filter and select etc, which is a good improvement. The downside is that it’s a lot slower. To run Get-Team with the beta module took a couple seconds. To run Get-Team using the new version takes about 5:40 for my 900-ish teams. Because of this the script below now takes about 17 minutes instead of around 12. This is based on ~900 teams and around 15 users per team. Hopefully this will get quicker as the Graph APIs improve.

More details on the updated module can be found here: https://techcommunity.microsoft.com/t5/Microsoft-Teams-Blog/Microsoft-Teams-PowerShell-Module-General-Availability/ba-p/480934

Have you ever looked at the Teams details in the Microsoft Teams admin center (centre, for people who can spell properly) and wanted to export it all to a CSV so you can play around with it in Excel?

Yeah, me too…

It uses one of those fancy infinite scroll features that requests more results as you scroll, which I guess means it’s unable to export to file as it hasn’t necessarily got all the results to hand.

Manage teams in Microsoft Teams admin center

I wanted to make a script that just used the native Teams PowerShell module which can be found (along with install instructions) here: https://www.powershellgallery.com/packages/MicrosoftTeams/

There are plenty of other way to get much more in-depth information but I wanted this to be as easy as possible to retrieve at the sacrifice of perhaps some more niche information.

The script below will do two reports for you:

Summary Report

The summary report will show everything you can see in the screenshot above.

Detailed Report

The detailed report gives you the names of every member of every Team, including their role.

As an indication of speed, in my environment the script below took 17 minutes to complete with 900-ish teams and an average of 15 users per team.

You might need to change the report output path in the two lines at the bottom very bottom, and make sure you’ve run the Connect-MicrosoftTeams cmdlet prior to running this script.

In case anyone wants it, here’s the script that worked with 0.9.6 module:

--

--

Matt Ellis
365 UC
Editor for

Unified Communications guy, Pompey fan, burger eater, coffee drinker...