routers with. You also have a lot to do and would rather automate
some stuff with scripts. I can help you learn to use Plink to make
simple batch files to automate work!
*(unlike most of my other posts, this one is for the Windows universe
and does not cover use of plink or scripting in Linux)
Plink is part of Putty and available at
download it from other places, this is the official location). It is
the command line interface for Putty and can be used in scripts. Be
sure to download the installer or the zip with all the files as Putty
is a great tool if you ever SSH, SCP or connect to network hardware in
general. The "latest development snapshot" is what I used for this
post, as things might change in the future and bugs be introduced or
other issues that would alter the information in this post -- please
use the stable release if you are timid.
Plink.exe is simple to use, but I have had problems with it and Linux
machines ("server refused keyboard-interactive authentication" issue).
That is why this post is all about Cisco, I have not had problems
there. An example to connect to a Cisco device is: c:\putty\plink.exe
firstname.lastname@example.org -pw P@55W0rD! where the user name is "cisco" with a
super secure password of "P@55W0rD!" connecting to a Cisco device with
an ip of 192.168.0.1. This command should get you a ">" prompt on the
Wait! How to I script this? How do I get enable access? To do much
else you need to make a command file.
A command file is just a text file with the list of commands you want
to run, in the order you need to run them. Here is an example
If I were to run: c:\putty\plink.exe email@example.com -pw P@55W0rD!
-m command.txt then I would get the memory and cpu statistics
displayed on the screen. If I were to redirect the output to a text
file with a "double waka" (>>), like this: c:\putty\plink.exe
firstname.lastname@example.org -pw P@55W0rD! -m command.txt >>
router_utilization.txt then I could have a text file with the date
and time, memory and cpu statistics. If this command were in a batch
file that was scheduled to run periodically then it could keep a
running log of the device.
For extra credit, how might we get this script to run and check stats
on different devices? If we make a separate file called "devices.txt"
that contained the IP addresses of the devices we need to monitor like
Then we could run this command (provided that the account name,
password and enable password were the same on each device):
for /f %i in (devices.txt) do c:\putty\plink.exe cisco@%i -pw
P@55W0rD! -m command.txt >> device_utilization.txt
(if you put this in a batch file, be sure to use "%%i" and not the
"%i" as the batch will strip the single percents)