Enter-PSSession : Connecting to remote server failed

2

I have three VMs: A, B and C. I use Enter-PSSession to connect them. But recently connecting B from A (A->B) never succeeds. Others ways (A->C, C->A, B->A, B->C, C->B) have no problem. The error message:

Enter-PSSession : Connecting to remote server mymachine failed with the following error message : WinRM cannot process
the request. The following error with errorcode 0x80090322 occurred while using Kerberos authentication: An unknown
security error occurred.
 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 config. For more
information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:1
+ Enter-PSSession -ComputerName "mymachine" -Credential mydomain\myuser
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (mymachine:String) [Enter-PSSession], PSRemotingTransportException
    + FullyQualifiedErrorId : CreateRemoteRunspaceFailed

I use "winrm get winrm/config/service" on B, the results are

Service
    RootSDDL = O:NSG:BAD:P(A;;GA;;;BA)(A;;GR;;;IU)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD)
    MaxConcurrentOperations = 4294967295
    MaxConcurrentOperationsPerUser = 1500
    EnumerationTimeoutms = 240000
    MaxConnections = 300
    MaxPacketRetrievalTimeSeconds = 120
    AllowUnencrypted = false
    Auth
        Basic = false
        Kerberos = true
        Negotiate = true
        Certificate = false
        CredSSP = false
        CbtHardeningLevel = Relaxed
    DefaultPorts
        HTTP = 5985
        HTTPS = 5986
    IPv4Filter = *
    IPv6Filter = *
    EnableCompatibilityHttpListener = false
    EnableCompatibilityHttpsListener = false
    CertificateThumbprint
    AllowRemoteAccess = true

The result of "winrm get winrm/config/client" on A:

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

There is no difference among the results of "winrm get winrm/config/client" on A, B and C.

Anyone got a clue?

powershell
winrm
ps
asked on Server Fault Mar 25, 2019 by liupro925 • edited Mar 25, 2019 by liupro925

1 Answer

1

Finally, with help of another colleague, I find out KDC of machine A is different from that of machine B and C.

So I use the following commands to reset it.

klist purge
klist purge_bind
klist add_bind "domain" "kdc"

Update: Seems the binding is always been reset. So I use the following command to set kdc

ksetup /addkdc "realmname" "kdc"
answered on Server Fault Mar 25, 2019 by liupro925 • edited Mar 26, 2019 by liupro925

User contributions licensed under CC BY-SA 3.0