Backup Switch Config using SCP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2018 12:04 AM - edited 03-05-2019 10:54 AM
Hello ,
I have a 2960 stack switch and i want to create a scirpt to download the config file to windows share folder .i dii it for all my firewalls and i dont know if it's possible to do it with other devices like my stack here .
Any idea please ?
Regards
- Labels:
-
LAN Switching
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2018 12:12 AM
Hi, you can use the built in auto archive feature. An explanetion is available here:
Otherwise you can write a code to connect into the switch using telnet or ssh, execute a show run and export the output of the show command.
Regard.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2018 12:17 AM
one of snippet from my notes : (make sure you understand the script before deploying in live environment, test and put in production.)
event manager applet sync-config event timer watchdog time 86400 action 1.0 cli command "enable" action 2.0 cli command "copy running scp://username:password@192.168.1.1/backup-config" pattern "Address" action 3.0 cli command "192.168.1.1" pattern "username" action 4.0 cli command "user" pattern "filename" action 5.0 cli command "backup-config"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2018 01:03 AM
Hi
could i do this :
cho y | pscp.exe -l $Username -pw $Password -v “$switch::sys_config” $BackupPath\$Date\ | out-host -verbose
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2018 08:47 AM
hi ,
any help about my last reply ?
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2018 09:03 AM
I have given the script to back up from device automatically to SCP to destination.
If you looking auto backup from out of the box, there are many methods to do.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2018 05:54 AM
yes i didnt like to make a autobackup procedure .so , im looking for a SCP method to tranfer the config file to share folder
regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2018 06:30 AM
Then original one do for SCP using EEM Script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2018 07:14 AM - edited 09-11-2018 01:30 PM
Hi
I have done almost the same.
echo y | pscp -scp admin@<ip>:startup-config hostname.cfg
*** Rate All Helpful Responses ***
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2018 11:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2018 11:50 AM
On a switch I think the startupfile is called config.text.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2018 12:05 PM
in switch is running-config
but, in my script when i exzcuted There is prompt to enter password, how you are programming this ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2018 12:14 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2018 01:30 PM
I am not using pscp in my script but plink to gather some information instead.
This is what I'm using:
echo|set /p="8.8.8.8 " & echo y | plink -ssh -pw cisco admin@8.8.8.8 "show run | inc hostname|008"
And this will create a output of "8.8.8.8 hostname MY-ROUTER-NAME"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2018 01:26 PM
Use the -pw <password> argument.
https://www.ssh.com/ssh/putty/putty-manuals/0.68/Chapter5.html
*** Rate All Helpful Responses ***