Thanks for the reply,
well, I found a solution... the command itself was not the problem, but using the RunCommand() method was so. Instead of the RunCommand() method I used the shellstream example from https://sshnet.codeplex.com/discussions/348421 and now it works!
well, I found a solution... the command itself was not the problem, but using the RunCommand() method was so. Instead of the RunCommand() method I used the shellstream example from https://sshnet.codeplex.com/discussions/348421 and now it works!
using System;
using System.IO;
using System.Threading;
using Renci.SshNet;
namespace ConsoleApplications
{
public class Program
{
private static System.ComponentModel.IContainer components;
private static void Main(string[] args)
{
using (var client = new SshClient(host, "admin", "abc"))
{
client.Connect();
using (var stream = client.CreateShellStream("dumb", 80, 24, 800, 600, 1024))
{
var reader = new StreamReader(stream);
var writer = new StreamWriter(stream);
writer.AutoFlush = true;
while (stream.Length == 0)
{
Thread.Sleep(500);
}
ReadStream(reader);
WriteStream("show run", writer, stream);
ReadStream(reader);
WriteStream("show ver", writer, stream);
ReadStream(reader);
}
client.Disconnect();
}
}
private static void ReadStream(StreamReader reader)
{
string line = reader.ReadLine();
while (line != null)
{
Console.WriteLine(line);
line = reader.ReadLine();
}
}
private static void WriteStream(string cmd, StreamWriter writer, ShellStream stream)
{
writer.WriteLine(cmd);
while (stream.Length == 0)
{
Thread.Sleep(500);
}
}
}
}