For more details, please see ourCookie Policy.

Fibre Channel (SAN) Technical Documents

Capture fibre switch port errors and clear errors for SAN Health using powershell

by Anonymous on ‎10-31-2012 04:59 PM (5,911 Views)

We have decided to run SAN Health on our fabrics in scheduled intervals. As it is recommended to clear the errors on the switches few days before you run the SAN Health, I had look into scripting to clear the errors for all ports on all switches.


The method used here is to use the open source utitlity called plink.exe (command line putty, which can be downloaded from PuTTY Download Page) to remotely run the commands porterrshow and porterrclear on each ports of the switches. The first pass will capture the current port errors to a file, which is best viewed using better file editor like notepad++ to keep the formatting. The script uses the smtp server to send the result to the mail box of your choice



the attachement contains

  • powershell script (Brocade-switch-err-clear.ps1)
  • List of fibre switches (fibre-switches.txt)
  • Command files (brocade1.txt & brocade2.txt)


If you are going to implement it in your environment you may have to do the following changes to the files

on Brocade-switch-err-clear.ps1

     update the smtp mail server and the from and to mail address

on fibre-switches.txt

     update the correct IP address in your farm

on brocade2.txt

     I have included the 40 ports in this list as I only have maximum of 40 ports in my switches, if you have more than 40 ports on any switch in the list above then you have to update this with the maximum number of ports.

Also download and copy the plink.exe to the same directory before running the script.


If you are planning to schedule this script to windows scheduler, try to run the script under the schedule user login to cache the SSH keys for the first time.