Backup HP ProCurve Switches via SSH, TFTP and PowerShell

15. February 2017

blog.feldmann.io

PowerShell Version: >4 
Modules: Posh-SSH

So, this is a pretty specific one! I have been tasked to backup old and new ProCurve Switches and of course I am using PowerShell for this 😉 I found a script about doing this via SFTP where you enable ip ssh filetransfer on the switches and get the files from there but unfortunately two of the 2610’s in the environment do a reboot on every sftp connection…so…that is not an option here 😉 The only good alternative I came up with was to SSH on the client and use TFTP to copy the configs where you want them. The tftp client is enabled on the ProCurve’s by default so what you need to do this is PowerShell with Posh-SSH, and a TFTP Server:

As for the creds I chose a password file as secure-string – not the safest but fairly easy to work with:

 

Share on LinkedIn
Linkedin
Share on Google+
Google+
0Share on Reddit
Reddit
0Share on Facebook
Facebook
0Tweet about this on Twitter
Twitter
Email this to someone
email
Print this page
Print
#PowerShell
5 Comments
Matthias
17. February 2017 @ 14:30

Hi,

nice script.

Is it possible to check via stream.read() the result/end of the copy commands instead of waiting/hoping for finishing with sleep(10)?

Reply
admin
17. February 2017 @ 15:33

As soon as you get too many lines as feedback from the ssh session the connection will cut off so I would not recommend $stream.read() in this case 😉

Reply
Yano
1. June 2017 @ 16:46

Hi there, thank you for the script.

I got trouble using it, there isn’t any comment about the TFTP server.

How do you handle this point ? I’ve try to install TFTP on a Windows Server 2016 but it doesn’t work.

Reply
    Sebastian
    1. June 2017 @ 16:58

    You can use any kind of freeware TFTP server that works with your OS, I used tftp64 on 2008R2.

    Reply
      Yanover
      2. June 2017 @ 10:13

      I’ve installed tftp64 on my WSRV2016

      I’ve launch it and changed the Current Directory as “C:\tftp\”. I’ve choose the right network interface.

      When I run a copy running-config tftp IP_ADDR_TFTP_SRV, it says “000M Transport error” ..

      Of course the firewall is disable and tftp transport is enable as client server on my switch.

      Thank you

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *


*