I have about 45 network switches I used to access them manually (Telnet) to extract their active ports and the MAC address for each workstation connected to each port.

When I posted a question About 2 months ago on this board asking about how can I automate the login process to these switches, I received a valuable advice from Lligetfa to use PERL because it has the capability to do such thing.

Unlike SU.exe which used by Kix, I found Perl code does not need any service to be installed on the device which you will connect to it remotely and implement some commands on it.

The following Perl code login to one of these switches and implement the commands (remotely) which I used to implement manually.

use Net::Telnet;
my $Telnet = new Net::Telnet;
my $prmpt = '/[\w().-]*[\$#>:.]\s?(?:\(enable\))?\s*$/';
$telnet = new Net::Telnet ( Timeout=>20, Prompt => $prmpt, Errmode=>'die');
$telnet->open('XX.XXX.XXX.XXX');
$telnet->login('user Id','Password');
@lines= $telnet->cmd("Networking");
@lines= $telnet->cmd("IP");
@lines= $telnet->cmd("ipmac");
print STDOUT @lines;
$telnet->close;

Frankly speaking I have been using Kix for about 3 years and I like it too much and I hope if there is any Kix code or function that can do the same thing for me. Any help will be highly appreciated. Thank you.

Note: I am still facing some problem with the previous Perl code where in some cases give error message “timed-out waiting for command prompt---“ and I am working on solve it.