Scheduled Backup of Brocade Fabric Switches

Posted: August 1, 2014 in Scripts, Storage

Pretty simple one here, PowerShell wrapper to automate logging into Brocade Fabric switches and grabbing a full config backup. You’ll need to get a copy of Putty’s plink.exe and you also need a FTP/SFTP/SCP server. This version is setup for a FTP target.

It’s also worth noting, this stores username and passwords in clear text, so be careful or sort out storing the credentials in an encrypted file. Lastly, I haven’t tested this on all versions of FabOS. I have run it against some 6.4.x and some 7.x.x, but make sure you test it out for your version.

# Create a variable based on the date in the format of YYYYMMDD
$DateStamp = Get-Date -UFormat “%Y%m%d”

# Set the location of the Putty Link executable
$PLinkBin = “C:\Temp\plink.exe”

# Access details for destination FTP server
$FTPServer = “?.?.?.?”
$FTPUser = “brocade”
$FTPPass = “brocade”

# Access details for the FC switches. All switches must have the same login credentials
$FCSwitches = @(“fcs1″,”fcs2”)
$FCSwitchUser = “admin”
$FCSwitchPass = “password”

# Loop through each of the FC switches, creating a file name in the formate of Name-YYYYMMDD.txt.
# Login to each switch and run the configupload command to backup to the FTP server.
ForEach ($FCSwitch in $FCSwitches){
$BackupFileName = “$FCSwitch-$DateStamp.txt”
$BackupCommand = “configupload -all -ftp $FTPServer,$FTPUser,$BackupFileName,$FTPPass”
& $PLinkBin -pw $FCSwitchPass $FCSwitchUser@$FCSwitch $BackupCommand

  1. Panks says:

    getting error : unable to connect to host i.e switch . No host exist. However i tried telnet and it was working

  2. Aruna says:

    when i tried this, i got below error:
    Unexpected token ‘BackupCommand’ in expression or statement.

    • dthomo says:

      I would guess that there is an invalid character being passed into this line
      $BackupCommand = “configupload -all -ftp $FTPServer,$FTPUser,$BackupFileName,$FTPPass”
      Example might be if you had double-quotes in or another special character in your $FTPPass variable?

  3. Andy B says:

    Thank you, simple and to the point, worked flawlessly on my 3 switches. My san switch environment is small so I had just been manually backing them up before and after each change, this will make that much easier.

  4. JD says:

    We ran into an issue where the Brocade password contained spaces causing plink to blow up. Fix was to put single quote around the password line and pass double quotes to the plink command. ex $FCSwitchPass=’ ” This is my password with spaces.” ‘

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s