In this article, I will briefly explain how to back up the running configuration of Cisco switches to a TFTP server location using PowerShell.
Prerequisites
- A TFTP server should be configured and running.
- PowerShell module Posh-SSH should be installed on the node from which the script is running.
Workflow
- Collect credentials to SSH into the switch$creds = Get-Credential
- Create a new SSH session to the first switch in the list$sw_ssh = New-SshSession -ComputerName <Management IP of Cisco switch> -Credential $creds -Force -ConnectionTimeout 300
- Invoke the command to backup running config to TFTP server over the SSH session$cmd_backup = "copy running-config tftp://<IP of TFTP server>/config_backup.txt vrf management"Invoke-sshcommand -Command $cmd_backup -SSHSession $sw_ssh
You can schedule this PS script using a task scheduler so that the running configuration of switches can be backed up automatically on a daily basis or as per requirements. Hope this was useful. Cheers!
Complete project reference
https://github.com/vineethac/cisco_switch_backup
Related article
Dell EMC switch configuration backup using PowerShell
Complete project reference
https://github.com/vineethac/cisco_switch_backup
Related article
Dell EMC switch configuration backup using PowerShell