List all physical QLogic HBA’s driver and firmware information of all your ESXi 4.1/5.0 hosts using PowerCLI 5.0.1

I wanted to know the version of the QLogic HBA driver and firmware of all ESXi hosts. I took the script I used earlier to list all NIC info and edited it. I ended up with this:

$ExportFilePath = “C:\HostHBAsInfo.csv”
$PuttyUser = “root”
$PuttyPwd = “password”
$Plink = “D:\plink.exe”
$PlinkOptions = ” -v -pw $PuttyPwd”
$RCommand0 = “cat /proc/scsi/qla2xxx/“
$ESXHosts = Get-VMHost | Sort Name
$Report = @()
ForEach ($ESXHost in $ESXHosts) {
$pHbas = $ESXHost | Get-VMHostHBA -Type FibreChannel
$x = 3
ForEach ($pHba in $pHbas) {
$Message = “”
$HostInfo = {} | Select HostName,ESXVersion,Cluster,pHba,FCFirmwareVersion,DriverVersion,BIOSVersion,FCODEFirmware,EFIFirmware,FlashFirmware,ISP
$HostInfo.HostName = $ESXHost.Name
$HostInfo.ESXVersion = $ESXHost.Version
$HostInfo.Cluster = (Get-Cluster -VMHost $ESXHost.Name).Name
$HostInfo.pHba = $pHba.Model
Write-Host “Connecting to: ” $ESXHost.Name -ForegroundColor Green
$Command = $Plink + ” ” + $PlinkOptions + ” ” + $PuttyUser + “@” + $ESXHost.Name + ” ” + $RCommand0 + $x
$Message = Invoke-Expression -command $command
$HostInfo.FCFirmwareVersion = ($Message[1] -split “FC Firmware version “)[1]
$HostInfo.DriverVersion = ($Message[1] -split “Driver version “)[1]
$HostInfo.BIOSVersion = ($Message[5] -split “BIOS version “)[1]
$HostInfo.FCODEFirmware = ($Message[6] -split “FCODE version “)[1]
$HostInfo.EFIFirmware = ($Message[7] -split “EFI version “)[1]
$HostInfo.FlashFirmware = ($Message[8] -split “Flash FW version “)[1]
$HostInfo.ISP = ($Message[9] -split “ISP: “)[1]
$Report += $HostInfo
$x++
}
}
$Report = $Report | Sort-Object HostName
IF ($Report -ne “”) {
$Report | Export-Csv $ExportFilePath -NoTypeInformation
}
Invoke-Item $ExportFilePath

Please note the value of $x is the indexed value of your vmhba device. In my example the 2 HBA ports are the 4th and 5th overall storage devices.

To enable/disable the TSM-SSH service on each host, I used the following PowerCLI onliners (Thanks again Alan):

Get-VMHost | Sort Name | Get-VMHostService | Where { $_.Key -eq “TSM-SSH”} | Start-VMHostService

Get-VMHost | Sort Name | Get-VMHostService | Where { $_.Key -eq “TSM-SSH”} | Stop-VMHostService

Advertisements

About Yuri de Jager
Technology Addict

2 Responses to List all physical QLogic HBA’s driver and firmware information of all your ESXi 4.1/5.0 hosts using PowerCLI 5.0.1

  1. Lio says:

    didnt work for ESXi 5.0 😦

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

%d bloggers like this: