A sessão PS remota falha no servidor não-domínio

8

Estou tentando conectar-me a um servidor Win2008R2 remoto que não faz parte do domínio usando o PS de um host Win8 (mesma sub-rede, é uma VM local). Tentei tudo o que pude encontrar, nada funciona.

SERVIDOR:

PS C:\Users\Administrator> winrm quickconfig
PS C:\Users\Administrator> enable-psremoting

CLIENTE:

PS C:\scripts> $cred = get-credential -username "administrator" -message "Enter password"

PS C:\scripts> $sess = new-pssession -computername 10.10.106.2 -credential $cred -authentication default
new-pssession : [10.10.106.2] Connecting to remote server 10.10.106.2 failed with the following error 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 added to the
TrustedHosts configuration setting. Use winrm.cmd to configure TrustedHosts. Note that computers in the TrustedHosts
list might not be authenticated. You can get more information about that by running the following command: winrm help
config. For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:9
  + $sess = new-pssession -computername 10.10.106.2 -credential $cred -authenticatio ...
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotingTransportException
    + FullyQualifiedErrorId : ServerNotTrusted,PSSessionOpenFailed

PS C:\scripts> winrm set winrm/config/client '@{TrustedHosts="10.10.106.2"}'
WSManFault
Message = The client cannot connect to the destination specified in the request. Verify that the service on the dest
ination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running o
n the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the
destination to analyze and configure the WinRM service: "winrm quickconfig".
Error number:  -2144108526 0x80338012
The client cannot connect to the destination specified in the request. Verify that the service on the destination is run
ning and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destinat
ion, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination t
o analyze and configure the WinRM service: "winrm quickconfig".

PS C:\scripts> $sess = new-pssession -computername 10.10.106.2 -credential $cred -usessl
new-pssession : [10.10.106.2] Connecting to remote server 10.10.106.2 failed with the following error message : WinRM
cannot complete the operation. Verify that the specified computer name is valid, that the computer is accessible over
the network, and that a firewall exception for the WinRM service is enabled and allows access from this computer. By
default, the WinRM firewall exception for public profiles limits access to remote computers within the same local
subnet. For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:9
  + $sess = new-pssession -computername 10.10.106.2 -credential $cred -usessl
  +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin   gTransportException
    + FullyQualifiedErrorId : WinRMOperationTimeout,PSSessionOpenFailed

O Oh e o RDP funcionam bem entre esses dois hosts com as mesmas credenciais.

Até isso funciona:

PS C:\scripts> Get-WinEvent -computername 10.10.106.2 -credential $cred
    
por Dendory 07.01.2015 / 17:33

5 respostas

12

No lado do cliente

winrm quickconfig
winrm set winrm/config/client '@{TrustedHosts="Computer1,Computer2"}'

No lado do servidor

Enable-PSRemoting -Force
winrm quickconfig

para https

winrm create winrm/config/Listener?Address=*+Transport=HTTPS @{Hostname="_";CertificateThumbprint="_"}

para http

winrm create winrm/config/Listener?Address=*+Transport=HTTP

Teste com

Test-WsMan ComputerName
Test-WsMan ComputerName -UseSSL

Editar: defina TrustedHosts com o PowerShell

Ou com o PowerShell (como administrador)

Set-Item -Path WSMan:\localhost\Client\TrustedHosts -Value "Computer1,Computer2"

E marque (não precisa de Admin para isso)

Get-Item WSMan:\localhost\Client\TrustedHosts
    
por 11.01.2015 / 13:00
4

Seu problema, encontrado em uma dessas mensagens de erro, é:

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 added to the TrustedHosts configuration setting.

Basicamente, você precisa definir o WinRM para usar HTTPS (em vez do HTTP padrão) ou adicionar a máquina você está se conectando como um host confiável na máquina à qual está se conectando.

    
por 07.01.2015 / 17:45
0

Eu finalmente tenho o meu para trabalhar ... onde xxx.xxx.xxx.xxx é o endereço IP.

PS C:\Users\Administrator> winrm quickconfig
WinRM service is already running on this machine.
WinRM is already set up for remote management on this computer.
PS C:\Users\Administrator> Enable-PSRemoting -Force
WinRM is already set up to receive requests on this computer.
WinRM is already set up for remote management on this computer.
PS C:\Users\Administrator> winrm set winrm/config/client '@{TrustedHosts="xxx.xxx.xxx.xxx"}'
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 = xxx.xxx.xxx.xxx

PS C:\Users\Administrator> Enter-PSSession  -ComputerName xxx.xxx.xxx.xxx -Credential "~\Administrator"
[xxx.xxx.xxx.xxx]: PS C:\Users\Administrator\Documents>
    
por 20.02.2018 / 17:36
0

Meu problema era uma instância hospedada na AWS.

  • Eu tive que abrir o 5985 no grupo de segurança de instâncias
  • Eu tive que modificar a regra de firewall para permitir 5985 para todos os perfis e qualquer endereço remoto

    New-NetFirewallRule -Name PsRemotingHttp -Direction Inbound -Action Permitir -Protocol tcp -LocalPort 5985 -DisplayName PsRemotingHttp

Eu trabalhei isso quando eu corri test-wsman:

"Por padrão, a exceção de firewall do WinRM para perfis públicos limita o acesso a computadores remotos na mesma sub-rede local."

    
por 21.02.2018 / 05:01
0

Depois de meses desse problema, para mim, acabei precisando adicionar o IP do servidor remoto e seu nome DNS aos hosts confiáveis. Apenas adicionar o IP não foi suficiente!

    
por 09.03.2018 / 08:16

Tags