Share via

Set-User : A parameter cannot be found that matches parameter name 'RemotePowerShellEnabled'.

Gerry Pierce 1 Reputation point
2022-12-27T20:21:28.687+00:00

I am attempting to disable remote PowerShell on some users and keep getting a parameter error.

get-user "john.j.smith@ssss .com" | set-user -RemotePowerShellEnabled $false

Which is a copy/paste from many online examples. I receive the following error.

Set-User : A parameter cannot be found that matches parameter name 'RemotePowerShellEnabled'.  
At line:1 char:53  
+ ... .j.smith@example.com" | set-user -RemotePowerShellEnabled  $false  
+                                            ~~~~~~~~~~~~~~~~~~~~~~~~  
    + CategoryInfo          : InvalidArgument: (:) [Set-User], ParameterBindingException  
    + FullyQualifiedErrorId : NamedParameterNotFound,Set-User  

Further notes:
I have executed Connect-ExchangeOnline with an admin account.
Get-Help Set-User shows that RemotePowerShellEnabled is a known parameter
ExchangeOnlineManagement is version 3.0.0

Thanks in advance.

Exchange Online
Exchange Online

A cloud-based service included in Microsoft 365, delivering scalable messaging and collaboration features with simplified management and automatic updates.


1 answer

Sort by: Most helpful
  1. Andy David - MVP 160.3K Reputation points MVP Volunteer Moderator
    2022-12-27T20:51:37.227+00:00

    What perms does the "admin" account have?

    At a minimum the account needs to be in the MailRecipients role group

    $Perms = Get-ManagementRole -Cmdlet Set-User -CmdletParameters RemotePowerShellEnabled  
    $Perms  
    

    Name RoleType
    ---- --------
    Mail Recipients MailRecipients

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.