Skip to content

Commit cb15237

Browse files
authored
Merge pull request #9992 from DMoenks/patch-3
Update control-remote-powershell-access-to-exchange-servers.md
2 parents 2f8328d + be6db17 commit cb15237

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

exchange/docs-conceptual/control-remote-powershell-access-to-exchange-servers.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,21 @@ To prevent remote PowerShell access for a specific group of existing users, you
6161
To disable access to remote PowerShell for any number of users based on an existing attribute, use the following syntax:
6262

6363
```powershell
64-
$<VariableName> = <Get-Mailbox | Get-User> -ResultSize unlimited -Filter <Filter>
64+
$<VariableName> = <Get-Mailbox | Get-User> -ResultSize Unlimited -Filter <Filter>
6565
```
6666

6767
```powershell
68-
$<VariableName> | foreach {Set-User -RemotePowerShellEnabled $false}
68+
$<VariableName> | foreach {Set-User -Identity $_ -RemotePowerShellEnabled $false}
6969
```
7070

7171
This example removes access to remote PowerShell for all users whose **Title** attribute contains the value "Sales Associate".
7272

7373
```powershell
74-
$DSA = Get-User -ResultSize unlimited -Filter "(RecipientType -eq 'UserMailbox') -and (Title -like '*Sales Associate*')"
74+
$DSA = Get-User -ResultSize Unlimited -Filter "(RecipientType -eq 'UserMailbox') -and (Title -like '*Sales Associate*')"
7575
```
7676

7777
```powershell
78-
$DSA | foreach {Set-User -RemotePowerShellEnabled $false}
78+
$DSA | foreach {Set-User -Identity $_ -RemotePowerShellEnabled $false}
7979
```
8080

8181
### Use a list of specific users
@@ -87,7 +87,7 @@ $<VariableName> = Get-Content <text file>
8787
```
8888

8989
```powershell
90-
$<VariableName> | foreach {Set-User -RemotePowerShellEnabled $false
90+
$<VariableName> | ForEach-Object {Set-User $_ -RemotePowerShellEnabled $false}
9191
```
9292

9393
This example uses the text file C:\My Documents\NoPowerShell.txt to identify the users by their user principal name (UPN). The text file must contain one UPN on each line like this:
@@ -101,7 +101,7 @@ $NPS = Get-Content "C:\My Documents\NoPowerShell.txt"
101101
```
102102

103103
```powershell
104-
$NPS | foreach {Set-User -RemotePowerShellEnabled $false}
104+
$NPS | foreach {Set-User -Identity $_ -RemotePowerShellEnabled $false}
105105
```
106106

107107
## View the remote PowerShell access for users
@@ -121,17 +121,17 @@ Get-User -Identity "Sarah Jones" | Format-List RemotePowerShellEnabled
121121
To display the remote PowerShell access status for all users, run the following command:
122122

123123
```powershell
124-
Get-User -ResultSize unlimited | Format-Table -Auto Name,DisplayName,RemotePowerShellEnabled
124+
Get-User -ResultSize Unlimited | Format-Table Name,DisplayName,RemotePowerShellEnabled -AutoSize
125125
```
126126

127127
To display only those users who don't have access to remote PowerShell, run the following command:
128128

129129
```powershell
130-
Get-User -ResultSize unlimited -Filter 'RemotePowerShellEnabled -eq $false'
130+
Get-User -ResultSize Unlimited -Filter 'RemotePowerShellEnabled -eq $false'
131131
```
132132

133133
To display only those users who have access to remote PowerShell, run the following command:
134134

135135
```powershell
136-
Get-User -ResultSize unlimited -Filter 'RemotePowerShellEnabled -eq $true'
136+
Get-User -ResultSize Unlimited -Filter 'RemotePowerShellEnabled -eq $true'
137137
```

0 commit comments

Comments
 (0)