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,517 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,408 questions
0 comments No comments
{count} votes

9 answers

Sort by: Most helpful
  1. Lothar Müller 5 Reputation points
    2023-03-06T16:56:13.3266667+00:00

    Same here today.

    But this Settings about HSTS at the Default Web Site has solved my issue. (disable HTTP to HTTPS redirect)
    d3c402c9-e0b8-48e9-948f-a1908adad563

    1 person found this answer helpful.

  2. Limitless Technology 39,436 Reputation points
    2022-02-08T10:40:20.24+00:00

    Hello @Oscar

    Please check the next conversation with the same error and solution:

    https://social.technet.microsoft.com/Forums/azure/en-US/cd97a10c-8697-4400-b008-792d6215ceff/ems-cant-connect-to-server-winrm-status-code-301?forum=Exch2016SD

    Also providing this article regarding the virtual directories, as it might help: https://learn.microsoft.com/en-us/exchange/clients/outlook-on-the-web/virtual-directories?view=exchserver-2019

    Hope this helps with your query,

    -----------

    --If the reply is helpful, please Upvote and Accept as answer--

    0 comments No comments

  3. Oscar 1 Reputation point
    2022-02-08T12:39:38.15+00:00

    Hi,

    unfortunately there's no redirect set there.

    0 comments No comments

  4. Oscar 1 Reputation point
    2022-02-08T12:59:50.703+00:00

    Can it have anything to do with psremoting? If i run this command Get-PSSessionConfiguration | Format-Table -Property Name, PermissionGet-PSSessionConfiguration | Format-Table -Property Name, Permission nothing is listed under PermissionGet-PSSessionConfiguration

    0 comments No comments

  5. Aaron Xue-MSFT 2,586 Reputation points Microsoft Vendor
    2022-02-09T07:56:03.473+00:00

    Hi @Oscar ,

    Did you make any changes before this issue occurred?

    Did you create a rewrite rule for the default site or PowerShell service in the IIS manager?

    1.Launch IIS Manager;
    2.Select the Powershell and find the URL Rewrite.
    172454-1.png
    172436-2.png

    If you add any rules in it, try to disble it and check if the issue still persist.


    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.