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
}

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s