Muokkaa

Jaa


Get-MsolGroup

Gets groups from Azure Active Directory.

Syntax

Get-MsolGroup
   [-UserObjectId <Guid>]
   [-IsAgentRole]
   [-UserPrincipalName <String>]
   [-GroupType <GroupType>]
   [-HasErrorsOnly]
   [-HasLicenseErrorsOnly <Boolean>]
   [-SearchString <String>]
   [-MaxResults <Int32>]
   [-TenantId <Guid>]
   [<CommonParameters>]
Get-MsolGroup
   -ObjectId <Guid>
   [-TenantId <Guid>]
   [<CommonParameters>]
Get-MsolGroup
   [-UserObjectId <Guid>]
   [-IsAgentRole]
   [-UserPrincipalName <String>]
   [-GroupType <GroupType>]
   [-HasErrorsOnly]
   [-HasLicenseErrorsOnly <Boolean>]
   [-SearchString <String>]
   [-All]
   [-TenantId <Guid>]
   [<CommonParameters>]

Description

The Get-MsolGroup cmdlet gets groups from Azure Active Directory. This cmdlet can be used to return a single group, if you specify the ObjectId parameter, or to search within all groups.

Examples

Example 1: Get a group by using an ID

PS C:\> Get-MsolGroup -ObjectId aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb

This command returns the group object that has the specified ID.

Example 2: Get all groups

PS C:\> Get-MsolGroup

This command returns the entire set of groups for the tenant, up to the default 250 results.

Example 3: Get a group by using a user principal name

PS C:\> Get-MsolGroup -isAgentRole -UserPrincipalName "pattifuller@contoso.com"

This command returns the agent groups that a user is a member of. This only applies for companies that have partner privileges.

Parameters

-All

Indicates that this cmdlet returns all results that it finds. Do not specify this parameter and the MaxResults parameter.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-GroupType

Specifies the type of groups to get. Valid values are Security, MailEnabledSecurity, and DistributionList.

Type:GroupType
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-HasErrorsOnly

Indicates that this cmdlet returns only groups that have validation errors.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-HasLicenseErrorsOnly

Specifies whether this cmdlet returns only security groups that have license errors.

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-IsAgentRole

Specifies that this cmdlet returns only agent groups. This value applies only to partner users.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-MaxResults

Specifies the maximum number of results that this cmdlet returns. The default value is 250.

Type:Int32
Position:Named
Default value:250
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ObjectId

Specifies the unique object ID of the group to get.

Type:Guid
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-SearchString

Specifies a string. This cmdlet returns security groups that have a display name that start with this string.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TenantId

Specifies the unique ID of the tenant on which to perform the operation. The default value is the tenant of the current user. This parameter applies only to partner users.

Type:Guid
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-UserObjectId

Specifies the unique ID of a user. This cmdlet returns security groups to which this user belongs. This parameter must be used along with the IsAgentRole parameter.

Type:Guid
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-UserPrincipalName

Specifies the user principal name of a user. This cmdlet returns security groups to which this user belongs. This parameter must be used along with the IsAgentRole parameter.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Outputs

Microsoft.Online.Administration.Group

This cmdlet returns a list of groups, which include the following information:

  • CommonName. The group's common name.

  • Description. A description of the group.

  • DisplayName. The group's display name.

  • EmailAddress. The group's email addresses. This is not returned for security groups.

  • Errors. A list of errors for the group.

  • GroupType. The group's type. Types can be SecurityGroup, DistributionList or MailEnabledSecurityGroup.

  • IsSystem. Whether or not this group is a system group (created by Azure Active Directory). These groups cannot be updated or removed.

  • LastDirSyncTime. The date and time that the group was last synched.

  • ManagedBy. The owner of the group.

  • ObjectId. The group's unique object ID.

  • Proxy Addresses. The proxy addresses associated with this group (for mail-enabled groups only).

  • ValidationStatus. Whether or not the group has any errors.