VMware Cloud Community
GabCava
Enthusiast
Enthusiast
Jump to solution

Get HBA firmware and driver version for all ESXi hosts

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 Solution

Accepted Solutions
BenLiebowitz
Expert
Expert
Jump to solution

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

Ben Liebowitz, VCP vExpert 2015, 2016, & 2017 If you found my post helpful, please mark it as helpful or answered to award points.

View solution in original post

28 Replies
habs3
Enthusiast
Enthusiast
Jump to solution

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       

        }

}

BenLiebowitz
Expert
Expert
Jump to solution

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

Ben Liebowitz, VCP vExpert 2015, 2016, & 2017 If you found my post helpful, please mark it as helpful or answered to award points.
AlbertWT
Virtuoso
Virtuoso
Jump to solution

How to modify it for the HBA driver?

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

/* Please feel free to provide any comments or input you may have. */
Reply
0 Kudos
GabCava
Enthusiast
Enthusiast
Jump to solution

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.

GabCava
Enthusiast
Enthusiast
Jump to solution

no worries Albert, these scripts only 'read'

BenLiebowitz
Expert
Expert
Jump to solution

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

Ben Liebowitz, VCP vExpert 2015, 2016, & 2017 If you found my post helpful, please mark it as helpful or answered to award points.
AlbertWT
Virtuoso
Virtuoso
Jump to solution

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 ?

/* Please feel free to provide any comments or input you may have. */
Reply
0 Kudos
BenLiebowitz
Expert
Expert
Jump to solution

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

Ben Liebowitz, VCP vExpert 2015, 2016, & 2017 If you found my post helpful, please mark it as helpful or answered to award points.
Reply
0 Kudos
Jangojongo
Contributor
Contributor
Jump to solution

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?

Reply
0 Kudos
betssontech
Contributor
Contributor
Jump to solution

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=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
Reply
0 Kudos
JedB
Contributor
Contributor
Jump to solution

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

SergOO
Enthusiast
Enthusiast
Jump to solution

$ESXHost = get-vmhost "myhost"

$esxcli = Get-EsxCli -vmhost $ESXHost

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

Reply
0 Kudos
mustafa_h
Contributor
Contributor
Jump to solution

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'
Reply
0 Kudos
HrcoCro
Contributor
Contributor
Jump to solution

Is it possible to  add a few more information's to the script?

I would also need Vendor ID (VID), Device ID (DID), Sub-Vendor ID (SVID), and Sub-Device ID (SDID) for nic and hba.

If you connect to esx host via putty and run this command "mkchdev -l |grep vmnic", the result for nic would be

002:01.0 8086:100f 15ad:0750 vmkernel vmnic0

In this example, the values are:

VID = 8086
DID = 100f
SVID = 15ad
SDID = 0750

same command for hba

vmkchdev -l |grep vmhba

 

Can this be added to the script?

 

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Reply
0 Kudos
swamynaveen
Enthusiast
Enthusiast
Jump to solution

@all, I'm getting below errors while fetching HBA /NIC firmware and driver version details. any suggestion would be really appreciated.

 
Script###### Start#################
vmhosts1 = Get-Content -Path "C:\Temp\HostList1.txt"


$report = @()

foreach ($ESXHost in $vmhosts1) {

$esxcli = Get-EsxCli -VMHost $ESXHost -V2

$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
 
Script###### End#################

 

 

Runtime Error:  no list method

Method invocation failed because [VMware.VimAutomation.ViCore.Impl.V1.EsxCli.EsxCliElementImpl] does not contain a method named 'list'.
At line:18 char:1
+ $nicfirmware = $esxcli.network.nic.list()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (list:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound

Method invocation failed because [VMware.VimAutomation.ViCore.Impl.V1.EsxCli.EsxCliElementImpl] does not contain a method named 'list'.
At line:22 char:1
+ $fcfirmware = $esxcli.storage.san.fc.list()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (list:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound

 

Regards,

Naveen

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

When you use the V2 switch on Get-EsxCli you have to use the Invoke() method.

$esxcli.software.vib.list.Invoke()


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
swamynaveen
Enthusiast
Enthusiast
Jump to solution

@LucD Thanks so much for the quick response. Actually i had tried with both options but no luck still the same issue.

 

Method invocation failed because [VMware.VimAutomation.ViCore.Impl.V1.EsxCli.EsxCliElementImpl] does not contain a method named 'list'.
At line:22 char:1
+ $fcfirmware = $esxcli.storage.san.fc.list()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (list:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound

Object of type 'InternalVimApi_50.ManagedObjectReference' cannot be converted to type 'System.String'.

Reply
0 Kudos
swamynaveen
Enthusiast
Enthusiast
Jump to solution

@LucD I'm getting below error now.

bject of type 'InternalVimApi_50.ManagedObjectReference' cannot be converted to type 'System.String'.
At line:22 char:1
+ $fcfirmware = $esxcli.storage.san.fc.list.Invoke()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException

Object of type 'InternalVimApi_50.ManagedObjectReference' cannot be converted to type 'System.String'.
At line:26 char:1
+ $driversoft = $esxcli.software.vib.list.Invoke()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException

Method invocation failed because [VMware.VimAutomation.ViCore.Impl.V1.EsxCli.EsxCliElementImpl] does not contain a method named 'get'.
At line:50 char:1
+ $NetworkFirmware = ($esxcli.network.nic.get($nicfirmwareselect.Name)) ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (get:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound

Reply
0 Kudos