WinRM cannot process the request - fails only over a specific domain

72,742

Run these commands on the client machine, then try to reach a remote host:

First we need to check TrustedHosts on the client machine:

PS C:\> WinRM get winrm/config/client
Client
    NetworkDelayms = 5000
    URLPrefix = wsman
    AllowUnencrypted = false
    Auth
        Basic = true
        Digest = true
        Kerberos = true
        Negotiate = true
        Certificate = true
        CredSSP = false
    DefaultPorts
        HTTP = 5985
        HTTPS = 5986
    TrustedHosts

If it's empty as in the example, run the command below on the client machine:

PS C:> Set-item wsman:localhost\client\trustedhosts -value *

This will write * in TrustedHosts parameter which will allow client machine to connect to any host, or you can configure this value with ip and/or hostname of the target server.

PS C:\> WinRM get winrm/config/client
Client
    NetworkDelayms = 5000
    URLPrefix = wsman
    AllowUnencrypted = false
    Auth
        Basic = true
        Digest = true
        Kerberos = true
        Negotiate = true
        Certificate = true
        CredSSP = false
    DefaultPorts
        HTTP = 5985
        HTTPS = 5986
    TrustedHosts = *
Share:
72,742
Admin
Author by

Admin

Updated on June 03, 2020

Comments

  • Admin
    Admin almost 4 years

    Some of ours servers (W2K8 R2) were moved to the cloud last week, once done that my powerswhell script started to fail (was working fine before), the exception is thrown on the line where the connection is trying to be established,

    $ExSession = New-PSSession –ConfigurationName Microsoft.Exchange –ConnectionUri     "http://$g_strExchangeServer/PowerShell" `
    -Credential $Credentials –Authentication Kerberos
    

    With the following message,

    [subd.staging.com] Connecting to remote server failed with the following error message : 
    **WinRM cannot process the request**. The following error occured while using Kerberos authentication: There are currently no logon servers available to service the logon request.  
    Possible causes are:
    -The user name or password specified are invalid.
    -Kerberos is used when no authentication method and no user name are specified.
    -Kerberos accepts domain user names, but not local user names.
    -The Service Principal Name (SPN) for the remote computer name and port does not exist.
    -The client and remote computers are in different domains and there is no trust between the two domains.
    After checking for the above issues, try the following:
    -Check the Event Viewer for events related to authentication.
    -Change the authentication method; add the destination computer to the WinRM TrustedHosts configuration setting or use HTTPS transport.
    Note that computers in the TrustedHosts list might not be authenticated.
    -For more information about WinRM configuration, run the following command: winrm help onfig. For more information, see the about_Remote_Troubleshooting Help topic.
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [], PSRemotingTransportException
    + FullyQualifiedErrorId : PSSessionOpenFailed
    

    this happens only if I try to target our testing domain, if I point the script to our production domain then it works.

    The same error is displayed on all the servers that were already moved to cloud.

    Notice that all the servers which have not already moved to cloud are able to run the script on both domains without any problem.

    I've tried the following, but no luck.

    //Add the destination computer to the WinRM TrustedHosts configuration setting. 
    c:\>WinRM set winrm/config/client @{TrustedHosts="stagingserver"} 
    
    
    //Confirm that WinRM is properly configured.  
    c:\>Winrm quickconfig  
    
    //Make sure that the remote server allows commands from any machine. 
    PS c:\>Set-item wsman:localhost\client\trustedhosts -value * 
    

    Using Powershell v2 and WinRM v2

    Any comments are welcome.

  • vinay
    vinay about 9 years
    This command is not working...Can you please let me know whether we need to restart the machine after executing this command
  • w128
    w128 about 8 years
    It may be helpful to note that this command needs to be executed on the client machine, i.e. the one making the connection - not on the targeted host. WinRM service might need to be restarted afterwards.
  • jzhang22
    jzhang22 about 7 years
    Need to use Powershell as an admin for the second command (right-click, "Run as administrator").