Command
Get-Microsoft365Group
Description
The command to get Microsoft 365 groups from a Microsoft 365 tenant.
Examples
Get a group by name
$tenant = Connect-Tenant -Domain tenantDomain Get-Microsoft365Group -Name "MyGroup" -Tenant $tenant
Get a group by id
$tenant = Connect-Tenant -Domain tenantDomain Get-Microsoft365Group -Id "12345678-1234-1234-1234-123456789012" -Tenant $tenant
Get multiple groups by name
$tenant = Connect-Tenant -Domain tenantDomain Get-Microsoft365Group -Name "MyGroup", "MyGroup2" -Tenant $tenant -AllowMultiple
Get multiple groups by id
$tenant = Connect-Tenant -Domain tenantDomain Get-Microsoft365Group -Id "12345678-1234-1234-1234-123456789012","22222222-1234-1234-1234-123456789012" -Tenant $tenant -AllowMultiple
Syntax
Get-Microsoft365Group
-Tenant <Tenant>
[-AllowMultiple <SwitchParameter>]
Get-Microsoft365Group
-Name <String[]>
-Tenant <Tenant>
[-AllowMultiple <SwitchParameter>]
Get-Microsoft365Group
-Id <Guid[]>
-Tenant <Tenant>
[-AllowMultiple <SwitchParameter>]
Parameters
-AllowMultiple <SwitchParameter>
Specifies that multiple Microsoft365 groups can be returned by the command.
Required? | False |
Position? | 2 |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-Id <Guid[]>
Specifies the id of the Microsoft365 group.
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 Microsoft365 group (wildcards supported).
Required? | True |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | True |
Parameter set name | Name |
Aliases | None |
-Tenant <Tenant>
Specifies the tenant.
Required? | True |
Default value | None |
Accept pipeline input? | True (ByValue) |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |