1

I am having some issues getting command to work with posh-ssh and Cisco gear.

Commands are pretty simple;

New-SSHSession -ComputerName 10.10.101.240 -Port 22

Will connect fine, and will give me an ID.

I then try

Invoke-SSHCommand -SessionId 0 -Command "show version"

but I always get

    Exception calling "EndExecute" with "1" argument(s): "An established connection was aborted by the server."
At C:\Program Files\WindowsPowerShell\Modules\Posh-SSH\2.0.2\Posh-SSH.psm1:266 char:25
+                         $Output = $_.cmd.EndExecute($_.Async)
+                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : SshConnectionException

I have tried different hosts and different PCs. I can, however, use $sshsession.write() and $sshsession.read() and I can talk to the switch fine.

Can anyone point out what I am doing wrong here?

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
markdem
  • 51
  • 1
  • 8
  • 2
    I cannot find an original documentation, but you can't use invoke-sshcommand with Cisco gear, you need to use the ShellStream / SSH Stream and write()/read() methods. https://github.com/darkoperator/Posh-SSH/issues/146 alludes to it – TessellatingHeckler Jul 17 '18 at 01:50
  • Thanks for the pointer.. I will just use write and read. – markdem Jul 17 '18 at 03:09

0 Answers0