Skip to content

Commit d63b7cf

Browse files
committed
Update find-exchange-cmdlet-permissions.md
Issue #7037
1 parent a7072a1 commit d63b7cf

File tree

1 file changed

+64
-45
lines changed

1 file changed

+64
-45
lines changed

exchange/docs-conceptual/find-exchange-cmdlet-permissions.md

Lines changed: 64 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,20 @@ You can use PowerShell to find the permissions required to run any Exchange or E
3333
3434
## Use PowerShell to find the permissions required to run a cmdlet
3535

36-
1. Open the PowerShell environment where you want to run the cmdlet.
36+
1. If you haven't already, open the Exchange PowerShell environment that you're interested in:
3737

3838
- **Exchange Online**: [Connect to Exchange Online PowerShell](connect-to-exchange-online-powershell.md).
3939

4040
- **Exchange Server**: [Open the Exchange Management Shell](open-the-exchange-management-shell.md) or [Connect to Exchange servers using remote PowerShell](connect-to-exchange-servers-using-remote-powershell.md).
4141

42-
2. Run the following command to identify the cmdlet and, optionally, one or more parameters on the cmdlet. Be sure to replace `<Cmdlet>` and optionally, `<Parameter1>,<Parameter2>,...` with the actual cmdlet and parameter names you are interested in. If you specify multiple parameters separated by commas, only the roles that include **all** of the parameters are returned.
42+
2. Replace `<Cmdlet>` and optionally, `<Parameter1>,<Parameter2>,...` with the values that you want to use, and run the following command:
4343

4444
```powershell
4545
$Perms = Get-ManagementRole -Cmdlet <Cmdlet> [-CmdletParameters <Parameter1>,<Parameter2>,...]
4646
```
4747

48+
**Note**: If you specify multiple parameters separated by commas, only roles that include the cmdlet with **all** of the parameters are returned.
49+
4850
3. Run the following command:
4951

5052
```powershell
@@ -57,78 +59,95 @@ The results contain the following information:
5759

5860
- **Role**: Indicates the role that gives access to the cmdlet or the combination of cmdlet and parameters. Note that role names that begin with "My" are user roles that allow regular users to operate on objects they own (for example, their own mailbox or their distribution groups).
5961

60-
- **RoleAssigneeType** and **RoleAssigneeName**: These values are inter-related. **RoleAssigneeType** is the type of object that has the role assigned to it, and **RoleAssigneeName** is the name of the object. **RoleAssigneeType** can be a role group, role assignment policy, security group, or user. Typically, administrator roles are assigned to role groups.
62+
- **RoleAssigneeType** and **RoleAssigneeName**: These values are inter-related:
63+
- **RoleAssigneeType** is the type of object that has the role assigned to it. For administrator roles, this value is typically a role group, but it can also be a role assignment policy, a security group, or a user.
64+
- **RoleAssigneeName** is the name of the role group, role assignment policy, security group, or user.
6165

6266
## Troubleshooting
6367

6468
What if there are no results?
6569

6670
- Verify that you entered the cmdlet and parameter names correctly.
6771

68-
- You might have entered too many parameters, and all of the parameters on the cmdlet aren't defined in a single role. Try specifying only the cmdlet name in Step 2, and run Step 3 to verify that the cmdlet is available in your environment. Then, add parameters one at a time to Step 2 before running Step 3.
72+
- The parameters that you specified aren't defined for a cmdlet in a single role. Try specifying only the cmdlet name in the first command before you run the second command. Then, add the parameters one at a time to the first command before you run the second command until the command returns no results.
6973

70-
- These possible causes have the same solution:
74+
Otherwise, no results are likely caused by one of the following conditions:
7175

72-
- You might have entered a cmdlet or parameters that are defined in a role that isn't assigned to anyone by default.
76+
- The cmdlet or parameters are defined in a role that isn't assigned to any role group by default.
77+
- The cmdlet or parameters aren't available in your environment. For example, you specified an Exchange Online cmdlet or Exchange Online parameters in an on-premises Exchange environment.
7378

74-
- You might have entered a cmdlet or parameter that isn't available in your environment. For example, when you enter an Exchange Online cmdlet or parameters in an on-premises Exchange 2016 environment.
79+
To find the roles in your environment (if any) that contain the cmdlet or parameters, replace `<Cmdlet>` and optionally, `<Parameter1>,<Parameter2>,...` with the values that you want to use and run the following command:
7580

76-
Run the following command to find the role that contains the cmdlet or parameters. Be sure to replace `<Cmdlet>` and optionally, `<Parameter1>,<Parameter2>,...` with the actual cmdlet and parameter names you are interested in. Note that you can use wildcard characters (*) in the cmdlet and parameter names (for example, `*-Mailbox*`).
81+
```powershell
82+
Get-ManagementRoleEntry -Identity *\<Cmdlet> [-Parameters <Parameter1>,<Parameter2>,...]
83+
```
7784

78-
```powershell
79-
Get-ManagementRoleEntry -Identity *\<Cmdlet> [-Parameters <Parameter1>,<Parameter2>,... ]
80-
```
85+
**Note**: You can use wildcard characters (*) in the cmdlet and parameter names (for example, `*-Mailbox*`).
8186

82-
- If the command returns an error saying the object couldn't be found, the cmdlet or parameters aren't available in your environment.
87+
If the command returns an error saying the object couldn't be found, the cmdlet or parameters aren't available in your environment.
8388

84-
- If the command returns one or more entries for **Name**, **Role**, and **Parameters**, the cmdlet (or parameters on the cmdlet) is available in your environment, but the required role isn't assigned to anyone. To see all roles that aren't assigned to anyone, run the following command:
89+
If the command returns results, the cmdlet or parameters are available in your environment, but the required role isn't assigned to any role groups. To see all roles that aren't assigned to any role groups, run the following command:
8590

86-
```powershell
87-
$na = Get-ManagementRole ; $na | foreach {If ((Get-ManagementRoleAssignment -Role $_.Name -Delegating $false) -eq $null) {$_.Name}}
88-
```
91+
```powershell
92+
$na = Get-ManagementRole; $na | foreach {If ((Get-ManagementRoleAssignment -Role $_.Name -Delegating $false) -eq $null) {$_.Name}}
93+
```
8994

9095
## Related procedures
9196

92-
- Management role scopes define where cmdlets can operate (in particular, write scopes).
97+
### Include management role scopes
98+
99+
Management role scopes (in particular, write scopes) define where cmdlets can operate. For example, the entire organization or only on specific user objects.
100+
101+
To include scope information in the [Use PowerShell to find the permissions required to run a cmdlet](#use-powershell-to-find-the-permissions-required-to-run-a-cmdlet) output, add `*Scope*` to the second command:
102+
103+
```powershell
104+
$Perms | foreach {Get-ManagementRoleAssignment -Role $_.Name -Delegating $false | Format-List Role,RoleAssigneeType,RoleAssigneeName,*Scope*}
105+
```
106+
107+
For more information about management role scopes, see [Understanding management role scopes](https://docs.microsoft.com/exchange/understanding-management-role-scopes-exchange-2013-help).
108+
109+
### Find all roles assigned to a specific user
110+
111+
To see all roles assigned to a specific user, replace `<UserIdentity>` with the name, alias, or email address of the user and run the following command:
112+
113+
```powershell
114+
Get-ManagementRoleAssignment -RoleAssignee <UserIdentity> -Delegating $false | Format-Table -Auto Role,RoleAssigneeName,RoleAssigneeType
115+
```
93116

94-
To include scope information in Step 2, substitute the following command:
117+
For example:
95118

96-
```powershell
97-
$Perms | foreach {Get-ManagementRoleAssignment -Role $_.Name -Delegating $false | Format-List Role,RoleAssigneeType,RoleAssigneeName,*Scope*}
98-
```
119+
```powershell
120+
Get-ManagementRoleAssignment -RoleAssignee [email protected] -Delegating $false | Format-Table -Auto Role,RoleAssigneeName,RoleAssigneeType
121+
```
99122

100-
- To see all roles assigned to a specific user, run the following command:
123+
**Note**: The _RoleAssignee_ parameter returns both direct role assignments to users (uncommon) and indirect role assignments granted to the user through their membership in role groups.
101124

102-
```powershell
103-
Get-ManagementRoleAssignment -RoleAssignee <UserIdentity> -Delegating $false | Format-Table -Auto Role,RoleAssigneeName,RoleAssigneeType
104-
```
125+
### Find all users who have a specific role assigned
105126

106-
For example:
127+
To see all users who have a specific role assigned to them, replace `<Role name>` with the name of the role and run the following command:
107128

108-
```powershell
109-
Get-ManagementRoleAssignment -RoleAssignee [email protected] -Delegating $false | Format-Table -Auto Role,RoleAssigneeName,RoleAssigneeType
110-
```
129+
```powershell
130+
Get-ManagementRoleAssignment -Role "<Role name>" -GetEffectiveUsers -Delegating $false | Where-Object {$_.EffectiveUserName -ne "All Group Members"} | Format-Table -Auto EffectiveUserName,Role,RoleAssigneeName,AssignmentMethod
131+
```
111132

112-
- To see all users who are assigned a specific role, run the following command:
133+
For example:
113134

114-
```powershell
115-
Get-ManagementRoleAssignment -Role "<Role name>" -GetEffectiveUsers -Delegating $false | Where-Object {$_.EffectiveUserName -ne "All Group Members"} | Format-Table -Auto EffectiveUserName,Role,RoleAssigneeName,AssignmentMethod
116-
```
135+
```powershell
136+
Get-ManagementRoleAssignment -Role "Mailbox Import Export" -GetEffectiveUsers -Delegating $false | Where-Object {$_.EffectiveUserName -ne "All Group Members"} | Format-Table -Auto EffectiveUserName,Role,RoleAssigneeName,AssignmentMethod
137+
```
117138

118-
For example:
139+
### Find the members of a role group
119140

120-
```powershell
121-
Get-ManagementRoleAssignment -Role "Mailbox Import Export" -GetEffectiveUsers -Delegating $false | Where-Object {$_.EffectiveUserName -ne "All Group Members"} | Format-Table -Auto EffectiveUserName,Role,RoleAssigneeName,AssignmentMethod
122-
```
141+
To see the members of a specific role group, replace `<Role group name>` with the name of the role group and run the following command:
123142

124-
- To see the members of a specific role group, run the following command:
143+
```powershell
144+
Get-RoleGroupMember "<Role group name>"
145+
```
125146

126-
```powershell
127-
Get-RoleGroupMember "<Role group name>"
128-
```
147+
For example:
129148

130-
For example:
149+
```powershell
150+
Get-RoleGroupMember "Organization Management"
151+
```
131152

132-
```powershell
133-
Get-RoleGroupMember "Organization Management"
134-
```
153+
**Note**: To see the names of all available role groups, run `Get-RoleGroup`.

0 commit comments

Comments
 (0)