Disable Remote Powershell for Exchange

Richard Long 381 Reputation points
2022-10-03T23:39:09.203+00:00

I'm following the guidance for the Exchange zero-days (link below) and I'm curious how others are disabling remote PowerShell access for non-admin users.

Is there a command to allow access for a specific ad group or local admins? Ideally we'd like to disable all of our standard users and allow just specific IT users.

How are others accomplishing this?

https://msrc-blog.microsoft.com/2022/09/29/customer-guidance-for-reported-zero-day-vulnerabilities-in-microsoft-exchange-server/

Thank you

Exchange | Exchange Server | Management
Exchange | Exchange Server | Management
The administration and maintenance of Microsoft Exchange Server to ensure secure, reliable, and efficient email and collaboration services across an organization.
Windows for business | Windows Server | Devices and deployment | Configure application groups
{count} votes

9 answers

Sort by: Most helpful
  1. Andy David - MVP 159.7K Reputation points MVP Volunteer Moderator
    2022-10-06T11:55:15.003+00:00

    If you screw up and disable an admin account, re-enable following:

    Add-PSSnapIn Microsoft.Exchange.Management.PowerShell.Snapin  
    set-user <user> -RemotePowerShellEnabled $true
    
    0 comments No comments

  2. Matt 1 Reputation point
    2022-10-07T08:41:37.027+00:00

    Hello,

    I asked myself the same question.

    Also, what about new users? Should we disable powershell remote access each time we have a newcomer to the company?

    I don't see any other solution besides disabling access for everyone, and enabling access for a short list of users right after...

    Has anyone found an easy way to do this?

    0 comments No comments

  3. Martin Bufton 1 Reputation point
    2022-10-07T11:25:45.327+00:00

    I'm effectively looking to run this:

    Get-ADGroupMember -identity 'Non admins' | set-user -RemotePowerShellEnabled $false

    Can someone help with the syntax please?

    0 comments No comments

  4. Martin Bufton 1 Reputation point
    2022-10-07T11:50:48.967+00:00

    To answer my own question I went down the OU route instead:

    Get-User | Where-Object {$_.OrganizationalUnit -ne 'Org.dns/ORG/Users/Engineers/Domain Administrators' | Set-User -RemotePowerShellEnabled $false

    can use and "and" to if required:

    Get-User | Where-Object {$.OrganizationalUnit -ne 'Org.dns/ORG/Users/Engineers/Domain Administrators' -and $.OrganizationalUnit -ne 'Org.dns/ORG/Service Accounts/On_prem'} | Set-User -RemotePowerShellEnabled $false


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.