Cómo conectarse a un servidor remoto usando powershell desde local. Enter-PSSession no funciona (servicio de Exchange no relacionado)

Cómo conectarse a un servidor remoto usando powershell desde local. Enter-PSSession no funciona (servicio de Exchange no relacionado)

Estoy intentando conectarme a una computadora remota mediante una sesión de PowerShell local.

para eso estoy intentando usar los comandos locales Enter-PSSession o New-PSSession de PowerShell como:

$session = New-PSSession -ConnectionUri 'http://testserverUri.dom/PowerShell'

Pero recibo todos los tiempos después de la excepción.

New-PSSession : [testserveruri.dom] Connecting to remote server apdv0710.forest7.dom failed with the following
error message : The WinRM client sent a request to an HTTP server and got a response saying the requested HTTP URL was
not available. This is usually returned by a HTTP server that does not support the WS-Management protocol. For more
information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:12
+ $session = New-PSSession -ConnectionUri 'http://testserverUri.dom/ ...
+            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin
   gTransportException
    + FullyQualifiedErrorId : URLNotAvailable,PSSessionOpenFailed

También utilicé otra variación:

    Enter-PSSession -Authentication Kerberos -ConnectionUri 'http://testserveruri.dom/PowerShell' -Cred $credential
    Enter-PSSession : Connecting to remote server apdv0710.forest7.dom failed with the following error message : The WinRM
    client sent a request to an HTTP server and got a response saying the requested HTTP URL was not available. This is
    usually returned by a HTTP server that does not support the WS-Management protocol. For more information, see the
    about_Remote_Troubleshooting Help topic.
    At line:1 char:12
    + $session = Enter-PSSession -Authentication Kerberos -ConnectionUri 'h ...
    +            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidArgument: (http://testserveruri.dom/PowerShell:Uri) [Enter-PSSession], PSRemot
       ingTransportException
        + FullyQualifiedErrorId : CreateRemoteRunspaceFailed

En la mayoría de los casos, obtengo la primera excepción.

Esta misma excepción ocurre mientras abro el espacio de ejecución usando C# y proporciono el objeto WSManConnectionInfo con la URL powerSell del servidor remoto.

Ya hice todos los detalles relacionados con los comandos winrm, pero esto realmente no resuelve el problema. ¿Cómo deshacerse de este problema?

Respuesta1

¿Por qué no simplemente Enter-PSSession apdv0710.forest7.dom?

Primero debe ejecutar Enable-PSRemotingapdv0710.forest7.dom.

Respuesta2

Esto funcionó para mí al proporcionar solo el nombre de la computadora, Kerberos como mecanismo de autenticación, además del objeto de credencial que contiene el nombre de usuario y la contraseña.

New-PSSession -Authentication Kerberos -Computer 'apdv004s' -Cred $credential 

Mismo uso para Enter-PSSession.

información relacionada