Running commands that pause for on-screen output

Sep 27, 2011 at 11:07 PM

first i want to say great tool/api... i was using plink.exe for ssh until i found this. i have been able to connect to various cisco components and run commands and get output fine. but one particular cisco hardware, when i connect and run first command "scope system" then issue "show firmware expand" i get a ton of output from the "show firmware expand" and it pauses each time with the MORE option and have to hit space bar to advance until all the output has been displayed... but for some reason the code is failing with

the string temp containing "                  ^\n% Invalid Command at '^' marker\n"

here is my code i am using. i even tried the command seperately with seperate variables. any suggestions on how to handle commands that display ton of output and pause with MORE option on screen?

using (var client = new SshClient("1.1.1.1", "admin", "password"))
            {
                client.Connect();
                var cmd = client.RunCommand("scope system;show firmware expand");
                string temp = cmd.Result;
                client.Disconnect();
            }

Sep 27, 2011 at 11:26 PM

ok well the length of output can't be an issue nor can the MORE option for addtional screen output.

i ran the following command sequence not alot of output :)


ucs6120c-B# scope system
ucs6120c-B /system # show version
UCSM:
    Running-Vers: 1.4(1m)
    Package-Vers:
    Activate-Status: Ready

ucs6120c-B /system # exit
ucs6120c-B#

so i tried it in the code updating the cmd variable... i get the same results "% Invalid Command at '^' marker" which happens when you issue a command not recognized. so i again i don't know why i am not able to run 2 commands at a time?

using (var client = new SshClient("1.1.1.1", "admin", "password"))
            {
                client.Connect();
                var cmd = client.RunCommand("scope system;show version");
                string temp = cmd.Result;
                client.Disconnect();
            }

 

Sep 27, 2011 at 11:38 PM

ok this code worked  , splitting up the commands the show version output which is like 4 lines was grabbed OK.

using (var client = new SshClient("1.1.1.1", "admin", "password"))
            {
                client.Connect();
                var cmd1 = client.RunCommand("scope system");
                var cmd = client.RunCommand(@"show version");
                string temp = cmd.Result;
                client.Disconnect();
            }

i then replaced "show version" with "show firmware expand" and i back to the "% Invalid Command at '^' marker" error showing up in string temp...

Coordinator
Sep 28, 2011 at 2:24 PM

I dont have a Cisco device here that I can test it.

I suspect its a device specific problem.

Is it possible for me to get some test user/pass to this device that I could test it remotely?

 

The only thought I have at a moment is that "show firmware expand" resluts in output that longer then 41723431 bytes.

 

I will try to explore what is the output limitation of SshCommand and see if I can fix it somehow to allow huge responses to be returned.

 

Thanks,

Oleg

Sep 28, 2011 at 7:13 PM

hi the output from the "show firmware expand" was 24KB or 24,576 bytes i was going to attach file but could not :( , and did not want alot of garbage on the post so i didn't just throw it in this post either ;)

 

 

Coordinator
Sep 28, 2011 at 7:15 PM

Hmm,

then I guess another guess would be is some kind of special character is sent that I dont know how to handle it :(.

but I would need to analyze the byte stream that coming back as a result to see why it happens :(