in reply to SSH2 for windows

Does the code you provided work for you on linux ? It doesn't for me. Seems to me that as soon as you '$chan->shell();' you lose the capability to get the output. There's simply nothing there to be read. To get the output, I find I have to '$chan->exec("command");'. Here's a demo that works for me on Windows:
use Net::SSH2; use warnings; use strict; my $buflen = 100; my $buf = '0' x $buflen; my $ssh2 = Net::SSH2->new(); $ssh2->connect('192.168.0.3') or die; $ssh2->auth_password('username','password') or die "Unable to login $! \n"; my $chan1 = $ssh2->channel(); $chan1->blocking(1); $chan1->exec('echo $PATH'); $chan1->read($buf, $buflen); print "BUF: ", $buf, "\n"; $chan1->close; my $chan2 = $ssh2->channel(); $chan2->blocking(1); $chan2->exec('echo $HOME'); $chan2->read($buf, $buflen); print "BUF: ", $buf, "\n"; $chan2->close;
It outputs:
BUF: /usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin BUF: /home/rob
If someone can provide me with a *nix script that both uses the shell() method and captures the output, then I'll take a look at replicating that on Windows.

Cheers,
Rob