cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
250
Views
0
Helpful
5
Replies

Backup CBS350

Thijs19901
Level 1
Level 1

Hi All,

I am trying to configure a script for saving the running-config to a fileserver for backup purposes. 
So, it must be able to run without user interaction and that a user must not be logged on the specific server where the script is running. I have tried multiple ways, telnet, ssh in powershell, plink etc etc.

What I see in the GUI that there is a connection

2024-Nov-22 16:28:50Informational%AAA-I-CONNECT: User CLI session for user USERNAME over ssh , source IP_SOURCE destination SWITCH_IP ACCEPTED

So that is great that there is a connection but from that moment it stops. For example, with this script below I am getting a connection but no file with the running config on the tftp server. I know that the tftp is working because if am running it from a ssh session it works.

# Switch IP
$switchip= "SWITCH_IP"

# Secure password
$securePassword = Import-Clixml -Path "C:\Runbook\securepassword2.xml"

# Maak een PSCredential-object aan (gebruik het geladen wachtwoord en de gebruikersnaam)
$credential = New-Object System.Management.Automation.PSCredential ("USERNAME", $securePassword)

# Plink uitvoerbare bestandspad
$plinkPath = "C:\Runbook\plink.exe"

# Commando voor het maken van de backup
$command = "copy running-config tftp://TFTP_IP/switch.cfg"

Start-Process -FilePath $plinkPath -ArgumentList "-ssh", "USERNAME@$switchip", "-pw", $credential.GetNetworkCredential().Password, $command, "-batch", "-no-antispoof" -NoNewWindow -Wait

What am I missing with this or does somebody have another solution to solved this? I know there is software that can do this, kiwicatools if i am correct, but it should also be able by scripting, right?

Hardware: CBS350 series

5 Replies 5

@Thijs19901 

 If you run this "copy running-config tftp://TFTP_IP/switch.cfg" using a normal SSH connection, do you succeed? 

Hi @Flavio Miranda ,

Yes, when i run this with a normal ssh connection it is working.

balaji.bandi
Hall of Fame
Hall of Fame

I have manually parsed the information command line and checked if that works.

https://the.earth.li/~sgtatham/putty/0.52/htmldoc/Chapter7.html

Plink is a bit hard sometimes; I use a simple Python script for backups. Or get cat tools  to back up device backups with simple GUI

 

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

Thijs19901
Level 1
Level 1

Hi @balaji.bandi ,

Thanks for the reply, with python i am successful.

 

Glad you able to resolve the issue, we mark as closed now if no other assistance required here.

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help