Skip to main content
Get Team
Updated this week

Command

Get-Team

Description

The command to get teams from a Microsoft 365 tenant.

Index

Examples

Get the tenant single team

$tenant = Connect-Tenant -Domain mytenantdomain
Get-Team -Tenant $tenant

Get the tenant teams

$tenant = Connect-Tenant -Domain mytenantdomain
Get-Team -Tenant $tenant -AllowMultiple

Get a team by name

$tenant = Connect-Tenant -Domain mytenantdomain
Get-Team -Name "MyTeam" -Tenant $tenant

Get all teams with the same name

$tenant = Connect-Tenant -Domain mytenantdomainGet-Team -Name "MyTeam" -Tenant $tenant -AllowMultiple

Get multiple teams by name

$tenant = Connect-Tenant -Domain mytenantdomainGet-Team -Name "FirstTeam", "SecondTeam" -Tenant $tenant

Get multiple teams by name using wildcards

$tenant = Connect-Tenant -Domain mytenantdomainGet-Team -Name "*Team" -Tenant $tenant -AllowMultiple

Note: The * symbol is used to call multiple objects with a similar name.

Get a team by id

$tenant = Connect-Tenant -Domain mytenantdomainGet-Team -Id "12345678-1234-1234-1234-123456789012" -Tenant $tenant

Get multiple teams by id

$tenant = Connect-Tenant -Domain mytenantdomainGet-Team -Id "11111111-1234-1234-1234-123456789012","22222222-1234-1234-1234-123456789012" -Tenant $tenant

How to handle a conflict with the Get-Team command from the Microsoft Teams PowerShell module

If you have the Microsoft Teams PowerShell module installed, you might get errors due to a conflict with the Get-Team command included with that module as well.

You can use a prefix to solve that issue in your script. Create a prefix on the Import-Module line, and add that prefix in your get command as shown in the example below:

Import-Module sharegate -Prefix MY$mypassword = ConvertTo-SecureString 'my_password' -AsPlainText -Force$mytenant = Connect-Tenant -Domain mydomain -Username "my_username" -Password $mypasswordGet-MYTeam -Tenant $mytenant -AllowMultiple

This will use the ShareGate Get-Team command instead of the Microsoft Teams version.

Syntax

Get-Team-Tenant <Tenant>[-AllowMultiple <SwitchParameter>]
Get-Team-Name <String[]> -Tenant <Tenant>[-AllowMultiple <SwitchParameter>]
Get-Team-Id <Guid[]> -Tenant <Tenant>[-AllowMultiple <SwitchParameter>]

Parameters

-AllowMultiple <SwitchParameter>

Specifies that multiple teams can be returned by the command.

Required?

False

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-Id <Guid[]>

Specifies the id of the team.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

Id

Aliases

None

-Name <String[]>

Specifies the name of the team.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

True

Parameter set name

Name

Aliases

None

-Tenant <Tenant>

Required?

True

Default value

None

Accept pipeline input?

true (ByValue)

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

Did this answer your question?