Get-MgTeam

What is Get-MgTeam?

Get-MgTeam is a Microsoft Graph PowerShell cmdlet used to retrieve details of Microsoft Teams within your Microsoft 365 tenant. It allows administrators to list all teams, filter results, or retrieve specific team details using the team’s unique ID.

Why Use Get-MgTeam?

The Get-MgTeam cmdlet is ideal for automation scenarios such as:

  • Generating complete team inventories
  • Filtering teams by display name or other properties.
  • Extracting specific fields like IDs and names for reporting
  • Searching for teams matching certain keywords.

This automation saves time, reduces manual lookups in the Teams admin center, and supports bulk administrative tasks.


Prerequisites

Before using Get-MgTeam, ensure you have the Microsoft Graph PowerShell module installed and the necessary permissions granted.

Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "Team.ReadBasic.All"

How to Use Get-MgTeam?

Syntax:

Get-MgTeam -TeamId <id>

The cmdlet can be used to list all teams, fetch details for a specific team, or filter/search results to match your requirements.


Get-MgTeam Examples

  • List All Teams
  • Get-MgTeam -All
  • Get a Specific Team by ID
  • Get-MgTeam -TeamId "5b34b8a4-6e77-4d8a-94eb-9b150d938f97"
  • Filter Teams by Display Name
  • Get-MgTeam -Filter "displayName eq 'MSFT'"
  • Select Specific Properties of All Teams
  • Get-MgTeam -All -Property "id", "displayName"
  • Search for a Team
  • 
        $users = Import-Csv "C:\Path\To\Users.csv"
        $teams = Get-MgTeam -All | Where-Object { $_.displayName -like '*Sales*' }
        $teams | ForEach-Object {
            "Team ID: $($_.Id) Team Name: $($_.displayName)"
        }

Did You Know? Managing Microsoft 365 applications is even easier with automation. Try our Graph PowerShell scripts to automate tasks like generating reports, cleaning up inactive Teams, or assigning licenses efficiently.

Ready to get the most out of Microsoft 365 tools? Explore our free Microsoft 365 administration tools to simplify your administrative tasks and boost productivity.

© Your Site Name. All Rights Reserved. Design by HTML Codex