Get-MsolRoleMember

Gets members of a role.

Syntax

Get-MsolRoleMember
   [-RoleObjectId <Guid>]
   [-MemberObjectTypes <String[]>]
   [-SearchString <String>]
   [-MaxResults <Int32>]
   [-TenantId <Guid>]
   [<CommonParameters>]
Get-MsolRoleMember
   [-RoleObjectId <Guid>]
   [-MemberObjectTypes <String[]>]
   [-SearchString <String>]
   [-All]
   [-TenantId <Guid>]
   [<CommonParameters>]

Description

The Get-MsolRoleMember cmdlet gets members of the specified role.

Examples

Example 1: Get members of a role

PS C:\> $Role = Get-MsolRole -RoleName "%Role Name%"
PS C:\> $RoleMembers = Get-MsolRoleMember -RoleObjectId $Role.ObjectId

This command returns all the members of the specified role. The command stores the results in the $RoleMembers variable.

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

-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

-MemberObjectTypes

Specifies an array of member object types.

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

-RoleObjectId

Specifies the unique ID of the role from which to remove members.

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

-SearchString

Specifies a string. This cmdlet returns objects with a display name or email address that start with this string. The string to search on.

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

Outputs

Microsoft.Online.Administation.RoleMember

This cmdlet returns role member objects that contain the following information:

  • DisplayName. The display name of the role member.

  • EmailAddress. The email address of the role member.

  • IsLicensed. Whether or not the user is licensed.

  • LastDirSyncTime. The date and time that this member was last synced.

  • ObjectId. The unique ID of the member.

  • OverallProvisioningStatus. The provisioning status of this user.

  • RoleMemberType. The type of role member. Currently only "User" is supported.

  • ValidationStatus. Whether or not there are any errors with this group member.