I would suggest you try to connect to EMS from remote PowerShell. If you cannot connect to EMS with remote PowerShell, it mean the EMS virtual directory has broken, you could take steps below to recreate it:
Run PowerShell with administrator privileges on your Exchange server, then import module below
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn;
You will could check EMS virtual directory with command below:
Get-PowerShellVirtualDirectory
Then use commands below to delete EMS virtual directory and recreate it:
Remove-PowerShellVirtualDirectory -Identity "EXName\PowerShell (Default Web Site)" -Confirm:$false
New-PowerShellVirtualDirectory -Server "EXName" -Name Powershell -InternalUrl https://EXName.domain.com/PowerShell -ExternalUrl https://mail.domain.com/PowerShell -RequireSSL:$false
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.