Ho avuto difficoltà a gestire winrm e TrustedHosts ma senza risultato. Dopo alcuni esperimenti ho scoperto che questo campo di winrm/config/client è limitato a 1023 simboli, il che non è abbastanza, specialmente se si aggiungono host dal proprio ipv6. Cito da Installation and Configuration for Windows Remote Management: A trusted hosts list should be set up when mutual authentication cannot be established.
Connessione al server remoto utilizzando winrm senza aggiungere il server a TrustedHosts
anche nello stesso file il testo dice: Other computers in a workgroup or computers in a different domain should be added to this list.
così ho pensato che questo implica che, fintanto che due computer si trovano nello stesso dominio, dovrei essere in grado di accedere a uno di loro dal altro usando winrm.
Ho provato ad aggiungere due computer a un dominio di prova e la giustiziati:
winrm get winrm/config/client -r:192.168.100.1 -u:user -p:pass
da uno di loro l'altro, ma questo non è riuscito con l'errore:
WSManFault
Message = The WinRM client cannot process the request. If the authentication
scheme is different from Kerberos, or if the client computer is not joined to a
domain, then HTTPS transport must be used or the destination machine must be ad
ded to the TrustedHosts configuration setting. Use winrm.cmd to configure Truste
dHosts. You can get more information about that by running the following command
: winrm help config.
Error number: -2144108316 0x803380E4
The WinRM client cannot process the request. If the authentication scheme is dif
ferent from Kerberos, or if the client computer is not joined to a domain, then
HTTPS transport must be used or the destination machine must be added to the Tru
stedHosts configuration setting. Use winrm.cmd to configure TrustedHosts. You ca
n get more information about that by running the following command: winrm help c
onfig.
Dopo aver aggiunto 192.168 .100.1 a TrustedHosts la query sopra ha esito positivo. Quindi la mia domanda è: è possibile utilizzare winrm tra due host senza modificare TrustedHosts? Impostare host sicuri su *
non è un'opzione per me.
Ci scusiamo per il ritardo. Potrebbe essere divertente ma non potrei trovarlo menzionato da nessuna parte sul web che se si utilizza il NomeComputer non è necessario aggiungere nulla a TrustedHosts. Ma ho verificato che funziona :) –