Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

New Member

Scripting Cisco Switches

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.

Thanks.

3 REPLIES
Cisco Employee

Re: Scripting Cisco Switches

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?

New Member

Re: Scripting Cisco Switches

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.

Cisco Employee

Re: Scripting Cisco Switches

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 (http://expect.nist.gov/) and OpenSSH for Windows (http://sshwindows.sourceforge.net/). 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:

username=parklabel

password=parklabel123

enable=enable123

Then:

set HOME=C:\TEMP

expect C:\TEMP\config_backup.exp 10.1.1.1

(Where 10.1.1.1 is the address of the switch).

This will create two files in C:\TEMP: 10.1.1.1.cfg and 10.1.1.1.ver.

726
Views
0
Helpful
3
Replies