To block all external network access to Exchange Admin Center (EAC) in Exchange Server 2019 using PowerShell, you can use the New-WebServicesVirtualDirectory
cmdlet to create a new virtual directory for EAC and configure it to only listen on the internal network interface. Here is an example of how to do this:
Copy code
# Connect to Exchange Server
$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://your-exchange-server-fqdn/PowerShell/
Import-PSSession $session
# Create a new virtual directory for EAC
$EACVD = New-WebServicesVirtualDirectory -Name "EAC" -InternalUrl "https://your-exchange-server-fqdn/EAC" -BasicAuthentication $true
# Configure the virtual directory to only listen on the internal network interface
Set-WebServicesVirtualDirectory -Identity $EACVD.Identity -InternalUrl $EACVD.InternalUrl -InternalAuthenticationMethods Basic
# Remove external access to EAC
Remove-WebServicesVirtualDirectory -Identity "EAC" -Confirm:$false