Menu

Multiple SSH Commands

Jeff
2010-07-16
2013-04-25
  • Jeff

    Jeff - 2010-07-16

    I was going to post this on the SharpSSH project, but then I noticed you are actually actively updating it and thought I'd post there to see if you knew how.  I'm trying to do a simple connection via SSH to a router, then run a series of commands on the same session on the router.  I can't disconnect between commands otherwise it won't work.  What I'm doing is this:

    SshExec exec = new SshExec(strHost, strUsername, strPassword);
    exec.Connect();
    strOutput = exec.RunCommand("command 1");
    strOutput += exec.RunCommand("command 2");
    exec.Close();
    

    And I'm using the strOutput to save the output from them.  But when I run it, I get a "session is down" exception from line 180 on the second RunCommand.

    Any ideas?

    Thanks

     
  • Jeff

    Jeff - 2010-07-16

    The exception was on line 180 of the Channel.cs file, mind went faster than I could type it.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.