Posh-SSH icon indicating copy to clipboard operation
Posh-SSH copied to clipboard

InvalidOperation: (Renci.SshNet.SshClient:SshClient)

Open jbielasz opened this issue 5 years ago • 2 comments

Hi, I've installed (by downloading .zip) and imported the Posh-ssh 2.2 module on Windows 2012 R2 machine.

I'm unable to establish an ssh session. I tried with different devices and of them throws the same error. The following error appears. I'm able to establish telnet to 22 port. The same code works fine on my PC (Windows 10).

PS D:> New-SSHSession -ComputerName "192.37.127.128" -Credential $creds -ErrorAction Stop -AcceptKey -ConnectionTimeout 10000 -Verbose

VERBOSE: Using SSH Username and Password authentication for connection.
Exception has been thrown by the target of an invocation.
At line:1 char:1
+ New-SSHSession -ComputerName "192.37.127.128" -Credential $creds -Err ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Renci.SshNet.SshClient:SshClient) [New-SSHSession], TargetInvocationException
    + FullyQualifiedErrorId : SSH.NewSshSession

Regards, Jakub

jbielasz avatar Apr 09 '20 13:04 jbielasz

Not seen that error before. Did you unprotect the zip and changed execution policy? Also did you upgrade the version of PS on the server to 5?

On Apr 9, 2020, at 9:48 AM, Jakub Bielaszka [email protected] wrote:

Hi, I've installed (by downloading .zip) and imported the Posh-ssh 2.2 module on Windows 2012 R2 machine.

I'm unable to establish ssh session. I tried different devices and of them throws the same error. The following error appears. I'm able to establish telnet to 22 port.

PS D:> New-SSHSession -ComputerName "192.37.127.128" -Credential $creds -ErrorAction Stop -AcceptKey -ConnectionTimeout 10000 -Verbose

VERBOSE: Using SSH Username and Password authentication for connection. Exception has been thrown by the target of an invocation. At line:1 char:1

  • New-SSHSession -ComputerName "192.37.127.128" -Credential $creds -Err ...
  •   + CategoryInfo          : InvalidOperation: (Renci.SshNet.SshClient:SshClient) [New-SSHSession], TargetInvocationException
      + FullyQualifiedErrorId : SSH.NewSshSession
    

Regards, Jakub

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/darkoperator/Posh-SSH/issues/322, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAD7IHQW6REHHT7OS2CBZALRLXG2FANCNFSM4MEXXOAA.

darkoperator avatar Apr 09 '20 16:04 darkoperator

I'm using PS 5.1. This is my execution policy. I believe it's default. Yes, I unblocked (Unblock-File Posh-sh.zip) the file.

PS D:\> Get-ExecutionPolicy -List

        Scope ExecutionPolicy
        ----- ---------------
MachinePolicy       Undefined
   UserPolicy       Undefined
      Process    RemoteSigned
  CurrentUser       Undefined
 LocalMachine          Bypass

jbielasz avatar Apr 10 '20 08:04 jbielasz