Scripting Cisco Switches

Unanswered Question
May 19th, 2007
User Badges:

I'm trying to run a script to backup configs from Cisco switches with SSH and I can't seem to run a loop with the username/password saved for the session.

I'm using Teraterm macro at this time.

Anyone has any suggestions or examples? I'll post my config if anyone's interested.


  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Joe Clarke Sat, 05/19/2007 - 16:33
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

I don't have any experience with TeraTerm macros, but I do have expect experience. How do you need to backup the configs (i.e. TFTP, simple screen scrape, etc.)? What switches running what IOS/CatOS?

parklabel Sat, 05/19/2007 - 16:46
User Badges:

For starters, I'm just trying to backup the configs (sh run, sh ver) from a couple of 6509 switches (IOS 12.2(18)). I'll have about 80-90 devices in a bit.

Another setback is that I don't have admin rights (yeah, I know) and I've only been able to use TeraTerm for scripting so far. I wish Putty had this feature.

Thank you.

Joe Clarke Sat, 05/19/2007 - 20:28
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

Here is an expect script that will do what you want. It can be made to work on Windows provided you have expect for Windows ( and OpenSSH for Windows ( It relies on a creds.txt file to exist in %HOME% (you may need to set this variable prior to running the script). For example, if you stick the script in C:\TEMP, create a C:\TEMP\creds.txt with:






expect C:\TEMP\config_backup.exp

(Where is the address of the switch).

This will create two files in C:\TEMP: and


This Discussion