New-PSSession to foreign domain ends up in error 0x80090311

Reiner Wolff 21 Reputation points
2021-03-06T17:01:55.253+00:00

Hi,
I try to reach a server in another domain with powershell remoting.
I use
$remote_session = New-PSSession -ComputerName "server.fqdn" -ConfigurationName KUCUK.Test -Credential "domain\user"

From 1 of my servers it works like a charme.
But all other machines I testet, I get this error:

>>

New-PSSession : [gusdc.emb.local] Beim Verbinden mit dem Remoteserver "gusdc.emb.local" ist folgender Fehler aufgetreten:
Die Anforderung kann von WinRM nicht verarbeitet werden. Bei Verwendung der Kerberos-Authentifizierung ist der folgende Fehler mit Fehlercode 0x80090311 aufgetreten: Sie können mit diesen Anmeldeinformationen nicht angemeldet werden, weil Ihre Domäne nicht verfügbar ist. Stellen Sie sicher, dass Ihr Gerät mit dem Netzwerk Ihrer Organisation verbunden ist, und versuchen Sie es erneut. Wenn Sie sich auf diesem Gerät zuvor mit anderen Anmeldeinformationen angemeldet haben, können Sie sich mit diesen Anmeldeinformationen anmelden. . Mögliche Ursachen: - Der angegebene Benutzername oder das angegebene Kennwort ist ungültig. - Kerberos wird verwendet, wenn keine Authentifizierungsmethode und kein Benutzername angegeben werden. - Kerberos akzeptiert Domänenbenutzernamen, aber keine lokale Benutzernamen. - Der Dienstprinzipalname (Service Principal Name, SPN) für den Remotecomputernamen und -port ist nicht vorhanden. - Der Clientcomputer und der Remotecomputer befinden sich in unterschiedlichen Domänen, zwischen denen keine Vertrauensbeziehung besteht. Wenn Sie die oben genannten Ursachen überprüft haben, probieren Sie folgende Aktionen aus: - Suchen Sie in der Ereignisanzeige nach Ereignissen im Zusammenhang mit der Authentifizierung. - Ändern Sie die Authentifizierungsmethode; fügen Sie den Zielcomputer der Konfigurationseinstellung "TrustedHosts" für WinRM hinzu, oder verwenden Sie den HTTPS-Transport. Beachten Sie, dass Computer in der TrustedHosts-Liste möglicherweise nicht authentifiziert sind. - Führen Sie den folgenden Befehl aus, um weitere Informationen zur WinRM-Konfiguration zu erhalten: "winrm help config". Weitere Informationen finden Sie im Hilfethema "about_Remote_Troubleshooting". In Zeile:1 Zeichen:19 + ... e_session = New-PSSession -ComputerName "gusdc.emb.local" -Configurat ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotingTran sportException + FullyQualifiedErrorId : AuthenticationFailed,PSSessionOpenFailed <<<

There is no entry in the eventlog on the destination server on that.
There is no impact on the Firewalls.
A connection to
telnet destination_server 5985
works from all machines.

What is the configuration difference on the working server?

Can somebody help me out?

kind regards,
Reiner Wolff

Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

Accepted answer
  1. Rich Matheisen 47,901 Reputation points
    2021-03-06T19:11:24.89+00:00

    Check the client machine's WinRM trusts.

    Get-Item WSMan:\localhost\Client\TrustedHosts
    

    If necessary, modify that list to include the target machine:

    winrm set winrm/config/client '@{TrustedHosts="remoteComputerName"}'
    

    Also, both machines have to agree on common security protocol.


4 additional answers

Sort by: Most helpful
  1. Andreas Baumgarten 123.6K Reputation points MVP Volunteer Moderator
    2021-03-06T17:14:29.147+00:00
    0 comments No comments

  2. Reiner Wolff 21 Reputation points
    2021-03-07T09:18:22.573+00:00

    Hi Rich,
    hi Andreas,

    thank you for your help.
    I knew it must be something simple because I got it already working on one machine for a year.
    And of course I spent a couple of hours on doing research on this.

    But I always thougt, that the TrustedHosts-List has to be configured on the destination server.
    So it makes no sense for me to look for that on the client starting the remote-session.

    The first link of Andreas helped me out here.
    Afterwards I was able to read the answer from Rich correct.

    But why it has to be configured on the source server?
    Shouldn't be the destination in control which machines could do something remote on the destination system?

    Kind regards,
    Reiner Wolff


  3. Andreas Baumgarten 123.6K Reputation points MVP Volunteer Moderator
    2021-03-07T09:54:17.437+00:00

    Hi @Reiner Wolff ,

    If I remember right you have to set the TrustedHosts on both machines.
    But maybe you set this on the destination machine on * before. The new client is covered in this TrustedHosts setting as well.

    You could check this with running Get-Item WSMan:\localhost\Client\TrustedHosts on both machines.

    I noticed the error message in your question is in German. Maybe this will help as well. There you can read the config needs to be done on both machines.

    Die Konfiguration muss auf beiden Computern durchgeführt werden.

    https://sid-500.com/2017/02/15/enter-pssession-trusted-hosts-konfigurieren/

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten

    0 comments No comments

  4. Reiner Wolff 21 Reputation points
    2021-03-08T07:39:13.53+00:00

    Although the problem is solved, I checked at the destination server the TrustedHosts entries.
    The list is empty.

    I read in the book 'PowerShell 5' by Dr. Tobias Weltner that the TrustedHosts list is to secure the source system.
    So you have control over your own system to whom it might connect to. This is because the source and the destination system are not in the same domain-forest and the authentication is therefore not on both sides.
    The destination server is only secured by authentication credentials and his firewall settings.

    So it should be right that the TrustedHosts list is empty on the destination server.

    Thank you for clarifying that for me.

    0 comments No comments

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.