The Get-MsolScopedRoleMember command in PowerShell gets members of a role who are granted that role over an administrative unit in Microsoft Office 365.
The syntax to get members of the specified role scoped to the administrative unit is given below.
Get-MsolScopedRoleMember
[-AdministrativeUnitObjectId <Guid>]
[-RoleObjectId <Guid>]
[-MaxResults <Int32>]
[-TenantId <Guid>]
[<CommonParameters>]
[-All]
In this article, we will discuss how to use the Get-MsolScopedRoleMember cmdlet in PowerShell to get the members of the specified role scoped to an administrative unit in Office 365.
How to Get Members of the User Administrator Role in Office 365
To get the members for the User Administrator role in Office 365, use the Get-MsolScopedRoleMember cmdlet with the -RoleObjectId
and the -AdministrativeUnitObjectId
parameter.
The -RoleObjectId
parameter specifies the unique object ID of the role from which to get the members and the -AdministrativeUnitObjectId
parameter specifies the unique object ID of the administrative unit.
# Get the East Coast Administrative unit $eastcoastAU = Get-MsolAdministrativeUnit -SearchString "East Coast" # Get the user belongs to User Administrator Role $UserAdmin = Get-MsolRole -RoleName "User Administrator" # Get members of the User Administrator role that is scoped to the administrative unit Get-MsolScopedRoleMember -RoleObjectId $UserAdmin.ObjectId -AdministrativeUnitObjectId $eastcoastAU.ObjectId
This command gets all members of the “User Administrator” role that is scoped to the administrative unit named “East Coast“.
Conclusion
I hope the above article on how to use the Get-MsolScopedRoleMember cmdlet in PowerShell to get the members of the role who are granted that role over an administrative unit is helpful to you.
You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.