Skip to content

Commit dc8aff6

Browse files
committed
Update disable-access-to-exchange-online-powershell.md
RemotePowerShellEnabled to EXOModuleEnabled
1 parent 778bbe6 commit dc8aff6

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed

exchange/docs-conceptual/disable-access-to-exchange-online-powershell.md

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
title: "Enable or disable access to Exchange Online PowerShell"
33
ms.author: chrisda
44
author: chrisda
5-
manager: dansimp
6-
ms.date: 9/1/2023
5+
manager: deniseb
6+
ms.date: 5/16/2024
77
ms.audience: Admin
88
audience: Admin
99
ms.topic: article
@@ -18,7 +18,7 @@ description: "Admins can learn how to disable or enable access to Exchange Onlin
1818

1919
Exchange Online PowerShell is the administrative interface that enables admins to manage the Exchange Online part of a Microsoft 365 organization from the command line (including many security features in Exchange Online Protection and Microsoft Defender for Office 365).
2020

21-
By default, all accounts in Microsoft 365 are allowed to use Exchange Online PowerShell. This access doesn't give users administrative capabilities in an organization. They're still limited by [role based access control (RBAC)](/exchange/permissions-exo/permissions-exo) (for example, they can configure settings on their own mailbox or manage distribution groups that they own).
21+
By default, all accounts in Microsoft 365 are allowed to use Exchange Online PowerShell. This access doesn't give users administrative capabilities in an organization. They're still limited by [role based access control (RBAC)](/exchange/permissions-exo/permissions-exo) (for example, they can configure settings on their own mailbox or manage distribution groups that they own, but not much else).
2222

2323
Admins can use the procedures in this article to disable or enable a user's ability to connect to Exchange Online PowerShell.
2424

@@ -30,10 +30,10 @@ Admins can use the procedures in this article to disable or enable a user's abil
3030

3131
- You need to be assigned permissions before you can do the procedures in this article. You have the following options:
3232
- [Exchange Online RBAC](/exchange/permissions-exo/permissions-exo): Membership in the **Organization Management** or **Recipient Management** role groups.
33-
- [Microsoft Entra RBAC](/microsoft-365/admin/add-users/about-admin-roles): Membership in the **Global Administrator** role.
33+
- [Microsoft Entra RBAC](/microsoft-365/admin/add-users/about-admin-roles): Membership in the **Global Administrator** role gives users the required permissions *and* permissions for other features in Microsoft 365.
3434

3535
> [!IMPORTANT]
36-
> In your haste to quickly and globally disable PowerShell access in your organization, beware of commands like `Get-User | Set-User -RemotePowerShellEnabled $false` without considering admin accounts. Use the procedures in this article to selectively remove remote PowerShell access, or preserve access for those who need it by using the following syntax in your global removal command: `Get-User | Where-Object {$_.UserPrincipalName -ne '[email protected]' -and $_.UserPrincipalName -ne '[email protected]'...} | Set-User -RemotePowerShellEnabled $false`.
36+
> In your haste to quickly and globally disable PowerShell access in your cloud-based organization, beware of commands like `Get-User | Set-User -EXOModuleEnabled $false` without considering admin accounts. Use the procedures in this article to selectively remove PowerShell access, or preserve access for those who need it by using the following syntax in your global removal command: `Get-User | Where-Object {$_.UserPrincipalName -ne '[email protected]' -and $_.UserPrincipalName -ne '[email protected]'...} | Set-User -EXOModuleEnabled $false`.
3737
>
3838
> If you accidentally lock yourself out of PowerShell access, create a new admin account in the Microsoft 365 admin center, and then use that account to give yourself PowerShell access using the procedures in this article.
3939
@@ -44,24 +44,23 @@ Admins can use the procedures in this article to disable or enable a user's abil
4444
4545
## Enable or disable access to Exchange Online PowerShell for a user
4646

47-
This example disables access to Exchange Online PowerShell for the user [email protected].
47+
This example disables access to Exchange Online PowerShell for the user `[email protected]`.
4848

4949
```powershell
50-
Set-User -Identity [email protected] -RemotePowerShellEnabled $false
50+
Set-User -Identity [email protected] -EXOModuleEnabled $false
5151
```
5252

53-
This example enables access to Exchange Online PowerShell for the user [email protected].
53+
This example enables access to Exchange Online PowerShell for the user `[email protected]`.
5454

5555
```powershell
56-
Set-User -Identity [email protected] -RemotePowerShellEnabled $true
56+
Set-User -Identity [email protected] -EXOModuleEnabled $true
5757
```
5858

5959
## Disable access to Exchange Online PowerShell for many users
6060

6161
To prevent access to Exchange Online PowerShell for a specific group of existing users, you have the following options:
6262

63-
- **Filter users based on an existing attribute**: This method assumes that the target user accounts all share a unique filterable attribute. Some attributes, such as Title, Department, address information, and telephone number, are visible only when you use the **Get-User** cmdlet. Other attributes, such as CustomAttribute1-15, are visible only when you use the **Get-Mailbox** cmdlet.
64-
63+
- **Filter users based on an existing attribute**: This method assumes that the target user accounts all share a unique filterable attribute. Some attributes, such as Title, Department, address information, and telephone number, are available only from the **Get-User** cmdlet. Other attributes, such as CustomAttribute1 to CustomAttribute15, are available only from the **Get-Mailbox** cmdlet.
6564
- **Use a list of specific users**: After you generate the list of specific users, you can use that list to disable their access to Exchange Online PowerShell.
6665

6766
### Filter users based on an existing attribute
@@ -71,15 +70,15 @@ To disable access to Exchange Online PowerShell for any number of users based on
7170
```powershell
7271
$<VariableName> = <Get-Mailbox | Get-User> -ResultSize unlimited -Filter <Filter>
7372
74-
$<VariableName> | foreach {Set-User -Identity $_.WindowsEmailAddress -RemotePowerShellEnabled $false}
73+
$<VariableName> | foreach {Set-User -Identity $_.WindowsEmailAddress -EXOModuleEnabled $false}
7574
```
7675

7776
This example removes access to Exchange Online PowerShell for all users whose **Title** attribute contains the value "Sales Associate".
7877

7978
```powershell
8079
$DSA = Get-User -ResultSize unlimited -Filter "(RecipientType -eq 'UserMailbox') -and (Title -like 'Sales Associate*')"
8180
82-
$DSA | foreach {Set-User -Identity $_.WindowsEmailAddress -RemotePowerShellEnabled $false}
81+
$DSA | foreach {Set-User -Identity $_.WindowsEmailAddress -EXOModuleEnabled $false}
8382
```
8483

8584
### Use a list of specific users
@@ -89,43 +88,43 @@ To disable access to Exchange Online PowerShell for a list of specific users, us
8988
```powershell
9089
$<VariableName> = Get-Content <text file>
9190
92-
$<VariableName> | foreach {Set-User -Identity $_ -RemotePowerShellEnabled $false}
91+
$<VariableName> | foreach {Set-User -Identity $_ -EXOModuleEnabled $false}
9392
```
9493

9594
The following example uses the text file C:\My Documents\NoPowerShell.txt to identify the users by their accounts. The text file must contain one account on each line as follows:
9695

97-
96+
9897
9998
After you populate the text file with the user accounts you want to update, run the following commands:
10099

101100
```powershell
102101
$NoPS = Get-Content "C:\My Documents\NoPowerShell.txt"
103102
104-
$NoPS | foreach {Set-User -Identity $_ -RemotePowerShellEnabled $false}
103+
$NoPS | foreach {Set-User -Identity $_ -EXOModuleEnabled $false}
105104
```
106105

107106
## View the Exchange Online PowerShell access status for users
108107

109108
To view the PowerShell access status for a specific user, replace \<UserIdentity\> with the name or user principal name (UPN) of the user, and run the following command:
110109

111110
```powershell
112-
Get-User -Identity "<UserIdentity>" | Format-List RemotePowerShellEnabled
111+
Get-User -Identity "<UserIdentity>" | Format-List EXOModuleEnabled
113112
```
114113

115114
To display the Exchange Online PowerShell access status for all users, run the following command:
116115

117116
```powershell
118-
Get-User -ResultSize unlimited | Format-Table -Auto Name,DisplayName,RemotePowerShellEnabled
117+
Get-User -ResultSize unlimited | Format-Table -Auto DisplayName,EXOModuleEnabled
119118
```
120119

121120
To display all users who don't have access to Exchange Online PowerShell, run the following command:
122121

123122
```powershell
124-
Get-User -ResultSize unlimited -Filter 'RemotePowerShellEnabled -eq $false'
123+
Get-User -ResultSize unlimited -Filter 'EXOModuleEnabled -eq $false'
125124
```
126125

127126
To display all users who have access to Exchange Online PowerShell, run the following command:
128127

129128
```powershell
130-
Get-User -ResultSize unlimited -Filter 'RemotePowerShellEnabled -eq $true'
129+
Get-User -ResultSize unlimited -Filter 'EXOModuleEnabled -eq $true'
131130
```

0 commit comments

Comments
 (0)