Teams inventory
Documentation: Microsoft Learn
Use Get-Team to report team names, Microsoft 365 group IDs, visibility, and archived status in a PowerShell inventory.
The script
Script reader
Inspect before you run
Inspect the script below. It does not run in this browser.
Inspection only — no command has run.
Show reference output
Inspect this example’s structure
Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.
Get-Team | Select-Object GroupId,DisplayName,Visibility,Archived- Stage 1Get-Team
Positional values or no named parameters - Stage 2Select-Object
Positional values or no named parameters
How it works
Get-Team returns each team with the GroupId that links it back to its underlying Microsoft 365 group, the display name, the Visibility setting separating public from private, and the Archived flag.
Adapting it
Join on GroupId against Get-MgGroup output to bring in creation dates and owners, which are the fields a lifecycle review needs and this cmdlet does not provide.
Requirements
MicrosoftTeams module with Connect-MicrosoftTeams, plus a Teams administrator role for full visibility.
If the result is unexpected
A Teams inventory excludes a team visible to another user.
Tenant context and the signed-in identity's permitted view can differ.
- Confirm the Teams connection and query a known team by its identifier under the intended account.
Validate the result
The known team is present or the access limitation is explicitly documented.
Keep the check reliable
Record the account context and avoid treating a restricted view as a tenant-wide count.