How To – Capture Cisco config with PuTTY

I was trying to backup the configuration from some Cisco devices without going to the hassle of actually connecting up the network interfaces. With just Putty and a serial connection here’s how I went about it.

Issue the “terminal length” command so that the output from commands isn’t paged. Without this we’d have to prune out the “–more–” from the terminal output.

router# terminal length 0

Next, configure Putty to log session output:

  1. Right-click the window title and choose “Change Settings…”;
  2. In the tree menu on the left, select “Logging” beneath “Session”;
  3. Select the “All session output” radio button and choose a suitable destination file;
  4. Finally, click “Apply” to dismiss the “PuTTY Reconfiguration” window.

Now issue a “show running-config” command and the configuration will be sent to your log file.

router# sh run

Published by

Dave Hope

Dave works in IT for a leading UK based retirement developer, in his spare time he enjoys tinkering with technology and rock climbing.

2 thoughts on “How To – Capture Cisco config with PuTTY”

  1. It works!
    But for some routers it gets logged off without capturing the whole output.
    Any specific reason?

  2. A variation on that trick: Create and save a PuTTY profile with logging turned on, but no hostname, called “Backup”. Create a text file called showrun.txt, that contains “show run” and no trailing newline. Then do “putty.exe -load Backup -m showrun.txt username@somecisco”. Scripting this to run through a list of switches and routers and use PKI login or -pw is left as an exercise for the reader. Unfortunately this trick only works for a single command, so not extensible for pushing out configuration changes. Also some models of Cisco map the running config to a special filename that can be grabbed with pscp

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.