The Get-MsolRoleMember cmdlet in PowerShell gets members of a role in Microsoft Office 365. This command retrieves the role member objects that contain the Display name of the role member, email address, objected, rolemembertype, islicensed, and validation status information.
The syntax to get members of a specified role is given below.
Get-MsolRoleMember [-RoleObjectId <Guid>] [-MemberObjectTypes <String>] [-SearchString <String>] [-All] [-TenantId <Guid>] [<CommonParameters>]
In this article, we will discuss how to use the Get-MsolRoleMember to get members of the specified role.
How to Get Members of a Role in Office 365
To get the members of a role in Office 365, use the Get-MsolRoleMember cmdlet in PowerShell.
# Get the Role object $Role = Get-MsolRole -RoleName "Company Administrator" # Get the members of a role Get-MsolRoleMember -RoleObjectId $Role.ObjectId
The Get-MsolRole cmdlet in PowerShell uses the
-RoleName parameter to specify the role name “Company Administrator” and retrieves the role and stores it in the
The Get-MsolRoleMember cmdlet in PowerShell uses the
-RoleObjectId parameter to specify the role objectId stored in the
$Role and retrieves the member of the role.
I hope the above article on how to use the Get-MsolRoleMember cmdlet in PowerShell to get the members of a role is helpful to you.
You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.