Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: RunCommand hangs and doesnt timeout either

$
0
0
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)
}

Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>