File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ $<VariableName> = <Get-Mailbox | Get-User> -ResultSize unlimited -Filter <Filter
65
65
```
66
66
67
67
``` powershell
68
- $<VariableName> | foreach {Set-User -RemotePowerShellEnabled $false}
68
+ $<VariableName> | foreach {Set-User -Identity $_ - RemotePowerShellEnabled $false}
69
69
```
70
70
71
71
This example removes access to remote PowerShell for all users whose ** Title** attribute contains the value "Sales Associate".
@@ -75,7 +75,7 @@ $DSA = Get-User -ResultSize unlimited -Filter "(RecipientType -eq 'UserMailbox')
75
75
```
76
76
77
77
``` powershell
78
- $DSA | foreach {Set-User -RemotePowerShellEnabled $false}
78
+ $DSA | foreach {Set-User -Identity $_ - RemotePowerShellEnabled $false}
79
79
```
80
80
81
81
### Use a list of specific users
@@ -87,7 +87,7 @@ $<VariableName> = Get-Content <text file>
87
87
```
88
88
89
89
``` powershell
90
- $<VariableName> | foreach {Set-User -RemotePowerShellEnabled $false
90
+ $<VariableName> | foreach {Set-User -Identity $_ - RemotePowerShellEnabled $false
91
91
```
92
92
93
93
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"
101
101
```
102
102
103
103
``` powershell
104
- $NPS | foreach {Set-User -RemotePowerShellEnabled $false}
104
+ $NPS | foreach {Set-User -Identity $_ - RemotePowerShellEnabled $false}
105
105
```
106
106
107
107
## View the remote PowerShell access for users
You can’t perform that action at this time.
0 commit comments