Get-MtRoleMember
Synopsis
Section titled “Synopsis”Returns all the members of a role.
Syntax
Section titled “Syntax”RoleName (Default)
Section titled “RoleName (Default)”Get-MtRoleMember [-Role] <String[]> [-MemberStatus <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]RoleId
Section titled “RoleId”Get-MtRoleMember [-RoleId] <Guid[]> [-MemberStatus <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]Description
Section titled “Description”The role can be either active or eligible, defaults to getting members that are both active and eligible.
If the assigned member is a group, all members of that group will be returned. A group that is not found (404) is skipped; any other error reading a group is thrown, so a check cannot pass without evaluating its members.
Results come from the session cache, so a second call in the same session returns the same members. Run Clear-MtGraphCache to read them again.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”Get-MtRoleMember -Role GlobalAdministratorReturns all the Global Administrators and includes both Eligible and Active members.
Example 2
Section titled “Example 2”Get-MtRoleMember -Role GlobalAdministrator -MemberStatus ActiveReturns all the Global Administrators that are currently active and excludes those that are eligible but not yet active.
Example 3
Section titled “Example 3”Get-MtRoleMember -Role GlobalAdministrator,PrivilegedRoleAdministratorReturns all the Global Administrators and Privileged Role administrators and includes both Eligible and Active members.
Example 4
Section titled “Example 4”Get-MtRoleMember -RoleId "00000000-0000-0000-0000-000000000000"Returns all the members of the role with the specified RoleId and includes both Eligible and Active members.
Example 5
Section titled “Example 5”Get-MtRoleMember -RoleId "00000000-0000-0000-0000-000000000000" -MemberStatus ActiveReturns all the currently active members of the role with the specified RoleId.
Parameters
Section titled “Parameters”The name of the role to get members for.
Type: String[]Parameter Sets: RoleNameAliases:
Required: TruePosition: 1Default value: NoneAccept pipeline input: FalseAccept wildcard characters: False-RoleId
Section titled “-RoleId”The ID of the role to get members for.
Type: Guid[]Parameter Sets: RoleIdAliases:
Required: TruePosition: 1Default value: NoneAccept pipeline input: FalseAccept wildcard characters: False-MemberStatus
Section titled “-MemberStatus”The type of members to look for. Default is both Eligible and Active.
Type: StringParameter Sets: (All)Aliases:
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False-ProgressAction
Section titled “-ProgressAction”Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by Write-Progress.
Type: ActionPreferenceParameter Sets: (All)Aliases: proga
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: FalseCommonParameters
Section titled “CommonParameters”This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.