13 Replies Latest reply on Sep 11, 2020 10:52 AM by mustafa_h

    Get HBA firmware and driver version for all ESXi hosts

    GabCava Novice

      Hello, as you probably know the only way to find out about HBA firmware and driver versions these days is by running:

       

      /usr/lib/vmware/vmkmgmt_keyval/vmkmgmt_keyval -d     to see which are the HBA devices, then

      /usr/lib/vmware/vmkmgmt_keyval/vmkmgmt_keyval -l -i vmhba1/qlogic     to actually retrieve the needed  info for a hba. In this particular case I get this precious data below:

       

      value:

      QLogic PCI to Fibre Channel Host Adapter for QMH2562:

              FC Firmware version 8.02.00 (90d5), Driver version 2.1.50.0

       

      which I need to retrieve from all my ESXi and save to a file. I enjoy writing simple powercli scripts but I'm puzzled about this one. I know that esxcli commands can be scripted too but what about this? I could script something with plink

       

       

      $plink = plink path

      $plinkAuth = " -v -pw $Pswd"

      $remoteCommand = '/usr/lib/vmware/vmkmgmt_keyval/vmkmgmt_keyval -l -i vmhba1/qlogic'

      $command = "Echo Yes| "+$plink + " " + $plinkAuth + " " + $User + "@" + $hostName + " " + $remoteCommand

      $result = Invoke-Expression -command $command

      $result

       

      but as the command above throws quite some stuff I don´t know how to grab only the data output I need and save it. Obviously this is to compare with vmware compatibility matrix later. Anyone did this? I already checked Re: Host Hardware info with HBA and nic driver information but the following values are returned blank, and not sure those match the  ones above that I need. I already added  the -V2 switch to the script of that post.

       

       

      Fnicvendor   :

      fnicdriver   :

      enicdriver   :

      Enicvendor   :

        • 1. Re: Get HBA firmware and driver version for all ESXi hosts
          habs3 Novice

          Here is one to get the NIC Driver and information and may be altered to get HBA info. Give it a try.

           

          $Clstr = Read-host "Enter Cluster Name to get NIC Info from Hosts?"

           

          $Hsts = (get-cluster $Clstr | get-vmhost).Name

          Write-output " Host Name,NIC Driver,NIC Version,NIC Firmware Version" | out-file c:\temp\$Clstr.txt

          foreach ($Hst in $Hsts)

          {

              $ECli = Get-esxcli -Vmhost $Hst

              $Nics = $Ecli.network.nic.list()

              $Nics

              foreach ($Nic in $Nics)

                  {

                  $NicInfo = $Ecli.network.nic.get($Nic.Name).driverinfo

                  $Hst + "," + $NicInfo.Driver + "," + $NicInfo.Version + "," + $NicInfo.FirmWareVersion | out-file c:\temp\$Clstr.txt -append       

                  }

          }

          1 person found this helpful
          • 2. Re: Get HBA firmware and driver version for all ESXi hosts
            Ben Liebowitz Expert
            vExpert

            We have Dell hardware and this is how I got the info via PowerCLI. Replace "lpfc" with the module name you're looking for drivers from.

             

            # Clear the List variable

            $List = @()

             

             

            # Start Loop to run command against all hosts in the Staging Cluster

            foreach ($vmhost in ((get-cluster Cluster1)| get-vmhost))

            {

            # Pipe the Get-esxcli cmdlet into the $esxcli variable

            $esxcli = $vmhost | get-esxcli

             

            # I used this to gather the VMHost Name for the exported CSV file.

            $VMHostName = $vmhost.Name

             

            # This is the ESXCLI command I ran to get the Driver Version out of the ESXCLI System Module Get DCUI Shell.

            $List += $esxcli.system.module.get("lpfc") | Select-object @{N="VMHostName";E={$VMHostName}}, Module, Version

            }

             

            # Results are compiled and exported to a CSV file.

            $List | export-csv -path E:\ben\vmware\HBA_info.csv -notypeinformation

            2 people found this helpful
            • 3. Re: Get HBA firmware and driver version for all ESXi hosts
              AlbertWT Master

              How to modify it for the HBA driver?

               

              I assume that the script does not cause any impact or outage when executed.

              • 4. Re: Get HBA firmware and driver version for all ESXi hosts
                GabCava Novice

                Many thanks Ben, that is what I was looking for. I replaced the driver with our qlnativefc and I got it right. I'll see to modify it to retrieve also the hba firmware version. As it is I only get the hba driver version.

                1 person found this helpful
                • 5. Re: Get HBA firmware and driver version for all ESXi hosts
                  GabCava Novice

                  no worries Albert, these scripts only 'read'

                  1 person found this helpful
                  • 6. Re: Get HBA firmware and driver version for all ESXi hosts
                    Ben Liebowitz Expert
                    vExpert

                    Take a look at the vDocumentation scripts by Ariel Sanchez Mora and Edgar Sanchez.  It gathers a lot of info and I believe this is one of the things.. HBA Drivers & Firmware.

                     

                    https://github.com/arielsanchezmora/vDocumentation

                    3 people found this helpful
                    • 7. Re: Get HBA firmware and driver version for all ESXi hosts
                      AlbertWT Master

                      BenLiebowitz,

                       

                      Thanks for sharing the script, however, it is not working:

                       

                      Message: Cannot access module instance.;

                      InnerText: Cannot access module instance.EsxCLI.CLIFault.summary

                      +     $List += $esxcli.system.module.get("lpfc") | Select-object @{N="V ...

                      +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                          + CategoryInfo          : OperationStopped: (:) [], ViError

                          + FullyQualifiedErrorId : VMware.VimAutomation.Sdk.Types.V1.ErrorHandling.VimException.ViError

                       

                      Does it means I do not have LPFC components ?

                      • 8. Re: Get HBA firmware and driver version for all ESXi hosts
                        Ben Liebowitz Expert
                        vExpert

                        The script I wrote is for HP hardware.  If you don't have the LPFC card, then yes, the script would fail. 

                        • 9. Re: Get HBA firmware and driver version for all ESXi hosts
                          Jangojongo Lurker

                          Does this script pull just the driver version or the HBA firmware as well? I see that you mentioned in your first comment that it pulls the driver version, but I do not see any mention of the HBA firmware. Can you please clarify?

                          • 10. Re: Get HBA firmware and driver version for all ESXi hosts
                            betssontech Lurker

                            It is not solved. It only shows driver. Not firmware. Same goes for vDocumentation (though it's a really nice script).

                            Hostname         : *

                            Version          : ESXi 6.0 U3

                            Slot Description : Mezzanine Slot 1

                            VMKernel Name    : vmhba0

                            Device Name      : Emulex LPe16000 16Gb PCIe Fibre Channel Adapter

                            Vendor Name      : Emulex Corporation

                            Device Class     : Fibre Channel

                            PCI Address      : 0000:09:00.0

                            VID              : 10df

                            DID              : e200

                            SVID             : 103c

                            SSID             : 1956

                            VIB Name         : lpfc

                            Driver           : lpfc

                            Driver Version   : 11.2.266.0-1OEM.600.0.0.2768847

                            Firmware Version : 

                            HCL URL          : https://www.vmware.com/resources/compatibility/search.php?deviceCategory=io&VID=10df&DID=e200&SVID=103c&SSID=1956&details=1

                            ProductId        : 39877

                            Hostname         : bma-bc03-esx13.ble.local
                            Version          : ESXi 6.0 U3
                            Slot Description : Mezzanine Slot 1
                            VMKernel Name    : vmhba0
                            Device Name      : Emulex LPe16000 16Gb PCIe Fibre Channel Adapter
                            Vendor Name      : Emulex Corporation
                            Device Class     : Fibre Channel
                            PCI Address      : 0000:09:00.0
                            VID              : 10df
                            DID              : e200
                            SVID             : 103c
                            SSID             : 1956
                            VIB Name         : lpfc
                            Driver           : lpfc
                            Driver Version   : 11.2.266.0-1OEM.600.0.0.2768847
                            Firmware Version : 
                            ProductId        : 39877
                            • 11. Re: Get HBA firmware and driver version for all ESXi hosts
                              JedB Novice

                              You can get these information much easier! Try "esxcli storage san fc list" in a ssh session.

                              Sample Output:

                                 Adapter: vmhba2

                                 Port ID: 7A4800

                                 Node Name: 20:00:00:10:9b:4f:xx:xx

                                 Port Name: 10:00:00:10:9b:4f:xx:xx

                                 Speed: 16 Gbps

                                 Port Type: NPort

                                 Port State: ONLINE

                                 Model Description: Emulex LightPulse LPe31000-M6 1-Port 16Gb Fibre Channel Adapter

                                 Hardware Version: 0000000c

                                 OptionROM Version: 11.2.210.13

                                 Firmware Version: 11.2.210.13

                                 Driver Name: lpfc

                                 DriverVersion: 11.4.33.1

                               

                              • 12. Re: Get HBA firmware and driver version for all ESXi hosts
                                SergOO Enthusiast

                                $ESXHost = get-vmhost "myhost"

                                $esxcli = Get-EsxCli -vmhost $ESXHost

                                $esxcli.storage.san.fc.list()

                                • 13. Re:Solved: Get HBA firmware and driver version for all ESXi hosts
                                  mustafa_h Lurker

                                  Hi,

                                  I found this script on one of the online forums, but first you have to have PowerCli 6.5 or later.

                                  1- Start PowerCli.

                                  2- Connect to your vCenter using Connect-VIServer command.

                                  3- Copy the below script to a notepad file and then rename it to .ps1

                                  4- From the PowerCli shell, go to the destination of your ps1 script and then execute.

                                   

                                  This script has exported HBA and VNICs firmware and driver versions info for all of my HPE ESXI hosts.

                                  If you want specific cluster or specific host, change the first line of the script with one of the following;

                                  Example:
                                  $vmhosts = Get-VMHost fqdn-of-your-esxihost - Check a single Host
                                  $vmhosts = Get-Cluster you-cluster-name | Get-VMHost - Checks all hosts in a cluster
                                  $vmhosts = Get-VMHost - Checks all hosts in the vCenter

                                   

                                   

                                  Script is below:

                                   

                                  ################################################

                                  $vmhosts = Get-VMHost

                                   

                                  $report = @()

                                   

                                  foreach ($ESXHost in $vmhosts) {

                                   

                                      $esxcli = Get-EsxCli -vmhost $ESXHost

                                   

                                      $nicfirmware = $esxcli.network.nic.list()

                                   

                                      $fcfirmware = $esxcli.storage.san.fc.list()

                                   

                                      $driversoft = $esxcli.software.vib.list()

                                   

                                          foreach($nicfirmwareselect in $nicfirmware)

                                   

                                              {

                                   

                                                  $NetworDescription = $nicfirmwareselect.Description

                                   

                                                  $NetworDriver = $driversoft | where { $_.name -eq ($nicfirmwareselect.Driver) }

                                   

                                                  $NetworkName = $nicfirmwareselect.Name

                                   

                                                  $NetworkFirmware = ($esxcli.network.nic.get($nicfirmwareselect.Name)).DriverInfo.FirmwareVersion

                                   

                                   

                                   

                                                  $report += "" |

                                   

                                                  select @{N = "Hostname"; E = { $ESXHost.Name } },

                                   

                                                  @{N = "Hardware-Model"; E = { $ESXHost.Model } },

                                   

                                                  @{N = "device"; E = { $NetworkName } },

                                   

                                                  @{N = "driver"; E = { $NetworDriver.Version } },

                                   

                                                  @{N = "firmware"; E = { $NetworkFirmware } },

                                   

                                                  @{N = "description"; E = { $NetworDescription } }

                                   

                                              }

                                   

                                          foreach($fcfirmwareselect in $fcfirmware)

                                   

                                              {

                                   

                                                  $fcDescription = $fcfirmwareselect.ModelDescription

                                   

                                                  $fcDriver = $driversoft | where { $_.name -eq ($fcfirmwareselect.DriverName) }

                                   

                                                  $fcName = $fcfirmwareselect.Adapter

                                   

                                                  $fcFirmware = $fcfirmwareselect.FirmwareVersion

                                   

                                   

                                   

                                                  $report += "" |

                                   

                                                  select @{N = "Hostname"; E = { $ESXHost.Name } },

                                   

                                                  @{N = "Hardware-Model"; E = { $ESXHost.Model } },

                                   

                                                  @{N = "device"; E = { $fcName } },

                                   

                                                  @{N = "driver"; E = { $fcDriver.Version } },

                                   

                                                  @{N = "firmware"; E = { $fcFirmware } },

                                   

                                                  @{N = "description"; E = { $fcDescription } }

                                   

                                              }

                                   

                                  }

                                   

                                  $report | Export-Csv -Path 'C:\ESXI HBA & NIC info.csv'

                                  ########################################################################
                                   
                                   
                                   
                                   
                                  $vmhosts = Get-VMHost
                                   
                                  $report = @()
                                   
                                  foreach ($ESXHost in $vmhosts) {
                                   
                                      $esxcli = Get-EsxCli -vmhost $ESXHost
                                   
                                      $nicfirmware = $esxcli.network.nic.list()
                                   
                                      $fcfirmware = $esxcli.storage.san.fc.list()
                                   
                                      $driversoft = $esxcli.software.vib.list()
                                   
                                          foreach($nicfirmwareselect in $nicfirmware)
                                   
                                              {
                                   
                                                  $NetworDescription = $nicfirmwareselect.Description
                                   
                                                  $NetworDriver = $driversoft | where { $_.name -eq ($nicfirmwareselect.Driver) }
                                   
                                                  $NetworkName = $nicfirmwareselect.Name
                                   
                                                  $NetworkFirmware = ($esxcli.network.nic.get($nicfirmwareselect.Name)).DriverInfo.FirmwareVersion
                                   
                                   
                                   
                                                  $report += "" |
                                   
                                                  select @{N = "Hostname"; E = { $ESXHost.Name } },
                                   
                                                  @{N = "Hardware-Model"; E = { $ESXHost.Model } },
                                   
                                                  @{N = "device"; E = { $NetworkName } },
                                   
                                                  @{N = "driver"; E = { $NetworDriver.Version } },
                                   
                                                  @{N = "firmware"; E = { $NetworkFirmware } },
                                   
                                                  @{N = "description"; E = { $NetworDescription } }
                                   
                                              }
                                   
                                          foreach($fcfirmwareselect in $fcfirmware)
                                   
                                              {
                                   
                                                  $fcDescription = $fcfirmwareselect.ModelDescription
                                   
                                                  $fcDriver = $driversoft | where { $_.name -eq ($fcfirmwareselect.DriverName) }
                                   
                                                  $fcName = $fcfirmwareselect.Adapter
                                   
                                                  $fcFirmware = $fcfirmwareselect.FirmwareVersion
                                   
                                   
                                   
                                                  $report += "" |
                                   
                                                  select @{N = "Hostname"; E = { $ESXHost.Name } },
                                   
                                                  @{N = "Hardware-Model"; E = { $ESXHost.Model } },
                                   
                                                  @{N = "device"; E = { $fcName } },
                                   
                                                  @{N = "driver"; E = { $fcDriver.Version } },
                                   
                                                  @{N = "firmware"; E = { $fcFirmware } },
                                   
                                                  @{N = "description"; E = { $fcDescription } }
                                   
                                              }
                                   
                                  }
                                   
                                   
                                   
                                  $report | Export-Csv -Path 'C:\Users\505000367110\Desktop\hba-info.csv'