Microsoft Teams PowerShell Report
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.
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:
The summary report will show (almost) everything you can see in the screenshot above. I say almost, because I can’t currently work out a way to export the Privacy of a Team using just the Microsoft Teams PowerShell module.
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 12 minutes to complete with 850-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’re run the Connect-MicrosoftTeams cmdlet prior to running this script.