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'