RunCommand hangs and doesnt timeout either

Aug 15, 2013 at 5:15 AM
Hi All,

I use PowerShell 3.0 with this library and cannot get Runcommand to work. I am trying to connect to a switch and execute a simple command like "show version". Below is the code. It just hangs and doesnt even timeout after 30 seconds.

Anything i am doing wrong here?

$Command = "n show version n"
$connectionInfo = New-Object Renci.SshNet.PasswordConnectionInfo(192.34.23.1, 22 , $Username, $Password)
$connectionInfo.Timeout = New-TimeSpan -Seconds 30
$sshClient = New-Object Renci.SshNet.SshClient($connectionInfo)
$sshClient.Connect()

if($sshClient.IsConnected)
{
hangs here and never comes out. ISE is dead and i have to kill it.
$sshOutput = $sshClient.RunCommand($Command)
}