Hi there,
I am having the same issue as you mentioned earlier. I started the Telnet services on both the server but the script is failing with a timeout error. Could you please paste the code which is working for you?
use warnings;
use Net::Telnet;
$myIPaddress = "Host IP";
$myDefaultPassword = 'pwd';
$myUsername = "username";
$myHostname = "somehostname";
$OutputFile = "$myHostname" . "_" . ".txt";
open (OUTPUT, ">>$OutputFile");
$telnet = new Net::Telnet ( Timeout=>10,Errmode=>'die');
$telnet->open("$myIPaddress");
$telnet->print("$myUsername");
$telnet->print("$myDefaultPassword");
$telnet->print("enable");
@running = $telnet->waitfor("/$myHostname# \$/i");
$running = "@running";
print OUTPUT $running;
close (OUTPUT);
Error -pattern match timed-out at C:\Lokesh\Perl\t.pl line 24
Please help...
Thanks, |