the WinRM client received an HTTP status code of 301 from the remote WS-Management service

Oscar 1 Reputation point
2022-02-07T13:54:23.613+00:00

Hi All,

I have two servers running 2019,

Server1 is the ad server
Server2 is the exchange 2019 server

I have about the same problem as in topic https://community.spiceworks.com/topic/2269100-exchange-2016-unable-to-open-exchange-management-shell

When i try to start the exchange management shell (exchange 2019, server 2019) i receive the following errors; (removed the domain name and the .local suffix)

From one day to the next my exchange shell stopped working with the 5 error messages that are in the topic above.
Things I tried;
Checked for redirects in iis, there are none. (could there be one in the registry wich i cant see here, where do i look?)
Checking the environment variables. They are ok.
Checking if winrm was installed on the exchange server. It wasn’t. So I installed. Even rebooted. No joy.
Ran winrm quickconfig. It says its already configured.
Tried iisreset. No joy.
Threw the server out of the window. No joy.
Seriously, I’m out of options. Anyone has a clue? Sidenote; i can also not install (KB5009557) , because after it's installed and the servers reboots i boots into a blue screen and gives a kernel security check error.

These are the errors;

New-PSSession : [server2] Connecting to remote server server2 failed with the following error
message : The WinRM client received an HTTP status code of 301 from the remote WS-Management service. For more informa
tion, see the about_Remote_Troubleshooting Help topic.
At line:1 char:1

  • New-PSSession -ConnectionURI "$connectionUri" -ConfigurationName Micr ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin
    gTransportException
  • FullyQualifiedErrorId : -2144108273,PSSessionOpenFailed
    VERBOSE: Connecting to SERVER2
    New-PSSession : [server2] Connecting to remote server server2 failed with the following error
    message : The WinRM client received an HTTP status code of 301 from the remote WS-Management service. For more informa
    tion, see the about_Remote_Troubleshooting Help topic.
    At line:1 char:1
  • New-PSSession -ConnectionURI "$connectionUri" -ConfigurationName Micr ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin
    gTransportException
  • FullyQualifiedErrorId : -2144108273,PSSessionOpenFailed
    VERBOSE: Connecting to SERVER2
    New-PSSession : [server2] Connecting to remote server server2 failed with the following error
    message : The WinRM client received an HTTP status code of 301 from the remote WS-Management service. For more informa
    tion, see the about_Remote_Troubleshooting Help topic.
    At line:1 char:1
  • New-PSSession -ConnectionURI "$connectionUri" -ConfigurationName Micr ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin
    gTransportException
  • FullyQualifiedErrorId : -2144108273,PSSessionOpenFailed
    VERBOSE: Connecting to SERVER2
    New-PSSession : [server2] Connecting to remote server server2 failed with the following error
    message : The WinRM client received an HTTP status code of 301 from the remote WS-Management service. For more informa
    tion, see the about_Remote_Troubleshooting Help topic.
    At line:1 char:1
  • New-PSSession -ConnectionURI "$connectionUri" -ConfigurationName Micr ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin
    gTransportException
  • FullyQualifiedErrorId : -2144108273,PSSessionOpenFailed
    VERBOSE: Connecting to SERVER2
    New-PSSession : [server2] Connecting to remote server server2 failed with the following error
    message : The WinRM client received an HTTP status code of 301 from the remote WS-Management service. For more informa
    tion, see the about_Remote_Troubleshooting Help topic.
    At line:1 char:1
  • New-PSSession -ConnectionURI "$connectionUri" -ConfigurationName Micr ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin
    gTransportException
  • FullyQualifiedErrorId : -2144108273,PSSessionOpenFailed
    Failed to connect to an Exchange server in the current site.
    Enter the server FQDN where you want to connect.:
Windows Server 2019
Windows Server 2019
A Microsoft server operating system that supports enterprise-level management updated to data storage.
3,744 questions
Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
7,626 questions
0 comments No comments
{count} votes

9 answers

Sort by: Most helpful
  1. Aaron Xue-MSFT 2,586 Reputation points Microsoft Vendor
    2022-02-14T09:01:08.003+00:00

    Hi @Oscar ,

    Here's a workaround.

    Try running below command in powershell to add Exchange Snapin.

    Then you could run the EMS command in Powershell.

    Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn  
    

    173998-6.png


    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.


  2. Aaron Xue-MSFT 2,586 Reputation points Microsoft Vendor
    2022-02-17T07:47:10.377+00:00

    Hi @Oscar ,

    No, I don’t think there are some “hidden” value in the IIS guide.

    The SSL settings would also affect this issue.

    Please check if Require SSL has been selected in the powershell site.

    175238-4.png
    175215-5.png

    If the require SSL has been selected, please disable it and check if the issue has been solved.


    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.


  3. Aaron Xue-MSFT 2,586 Reputation points Microsoft Vendor
    2022-02-21T09:12:51.25+00:00

    Hi @Oscar

    You could follow below steps to recreate powershell virtual directory to check if the issue has been solved.

    Open powershell with administrator and run the following commands

    Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn  
    Get-PowerShellVirtualDirectory -Server "Servername" | Format-List Server, Name, InternalUrl, Externalurl, Identity  
    Remove-PowerShellVirtualDirectory -Identity "Servername\PowerShell (Default Web Site)" -Confirm:$false  
      
    New-PowerShellVirtualDirectory -Server"servername"-Name Powershell -RequireSSL:$false  
    

    176335-4.png
    Run the following command on both the Client Access and Mailbox servers to restart Internet Information Services (IIS):

    Iisreset /nofrce  
    

    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.


  4. Aaron Xue-MSFT 2,586 Reputation points Microsoft Vendor
    2022-02-24T02:38:36.4+00:00

    Hi @Oscar ,

    Thanks for letting us know your user experience. According to your case description, I do understand how frustrated you are now.

    You could run add-snapin command in powershell to instead of the EMS until the issue is resolved.

    Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn  
    

    After you run the command. Even though there is an error when you open EMS, but you can run EMS related commands directly in powershell.

    I mean that you don’t need to open the EMS. You could run Powershell to instead of the EMS.


    If the response is helpful, please click "Accept Answer" and upvote it.

    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.


Your answer

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