Older switches don't have the nifty 'interface range' command for applying the same configuration to multiple interfaces at the same time. On older style 48 port switches, it can be a boring task to update all interfaces with, say, a new vlan assignment.
I was thinking of doing an Expect script to perform the task. I tackled it once upon a time, and did come up with a working example, but it took a while to get used to the nuances of the Expect language.
Having more skills in Perl, and realizing that there is a CPAN add-on for Cisco devices, I recently did something up in Perl. The example below connects to a switch, and for each of 48 interfaces, it defaults it and then applies a new vlan.
By creating an array of devices, and if they have common usernames and passwords, or are authenticated through TACACS, the same commands could be applied to a range of devices in one easy run.
use strict;
use Net::Telnet::Cisco;
my $postDevice = 'bmsw08';
my $postCommand = 'sho inter status';
my $session = Net::Telnet::Cisco->new(
Host => $postDevice
);
# $session->login( '', 'password' );
$session->login( 'username', 'password' );
$session->enable('enable');
my @output;
# my @output = $session->cmd(String => $postCommand );
# print @output;
print $session->cmd( String => 'config t' );
for ( my $i = 1; $i <= 48; $i++ ) {
print $session->cmd( String => "inter f0/$i" );
print $session->cmd( String => "default desc" );
print $session->cmd( String => "swi acc vlan 103" );
}
$session->close();
There are two types of logins, one with a username and password, and one with just a password. An Enable is used in either case.


