Highlighted
Expert
Expert

Host firmware, hba driver, NIC version etc,

Jump to solution

Hi All,

Can we pull the ESXi Build version, Host firmware, HBA driver version, HBA firmware version and Host NIC version from power cli at the cluster level?

Thanks

vmk

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
Highlighted
User Moderator
User Moderator

That could indicate an issue with your DNS setup.

You can try with the IP address instead of the FQDN

$clusterName = 'MyCluster'

$cmdSub = '/usr/lib/vmware/vmkmgmt_keyval/vmkmgmt_keyval -a'


$cred = Get-Credential -Message "Credentials for all ESXi node in cluster $($clusterName)"


Get-Cluster -Name $clusterName | Get-VMHost -PipelineVariable esx |

  ForEach-Object -Process {

  $esxNet = Get-VMHostNetwork -VMHost $_

  $fqdn = "$($esxNet.HostName).$($esxNet.DomainName)"

  $ip = (Get-VMHostNetworkAdapter -VMHost $esx -VMKernel | select -First 1).IP

  $session = New-SSHSession -ComputerName $ip -Credential $cred –AcceptKey

  $result = Invoke-SSHCommand -SSHSession $session -Command $cmdSub

  Remove-SSHSession -SSHSession $session | Out-Null

  $result.Output | Out-File -FilePath ".\report-$($fqdn).txt"

}


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

View solution in original post

0 Kudos
25 Replies
Highlighted
User Moderator
User Moderator

It depends, not all HW vendors and not all models provide that info in a way that ESXi can pick it up.

There are several examples in this community:

Re: Looking for a PowerCLI script to get the ESXi hosts all the NIC driver and firmware version

Host Hardware info with HBA and nic driver information

and many more if you do a search.

Btw, you asked a similar question (How to get HP Blade server for Gen8, Gen9 & Gen10 firmware version & ILO firmware version fr... ) where you didn't bother to reply.


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

0 Kudos
Highlighted
Expert
Expert

LucD,

Sorry, i didn't reply your earlier email thread. Sorry about that.  Earlier the requirement was a different i.e. firmware upgrade for all Host but recently we had an issue where VM's getting corrupted and VMware asked to upgrade HBA firmware for HP G10, hence want to pull the report for all the host having HP G10 Blade server.

However, link shared by you, I'll go through it and will get back.

thanks

vmk

0 Kudos
Highlighted
Expert
Expert

LucD,

I tried executing the first script but it throws an error

pastedImage_0.png

Powercli Script to get FW and driver version details for both HBA and NICs

0 Kudos
Highlighted
User Moderator
User Moderator

The line

foreach ($nic in $esxcli.network.nic.list()) {

should be

foreach ($nic in $esxcli.network.nic.list.Invoke()) {


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

0 Kudos
Highlighted
User Moderator
User Moderator

If you are after the HBA firmware on HP HW you might want to have a look at Re: PowerCLI Script to get ESXi Network/Storage Firmware and Driver Version


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

0 Kudos
Highlighted
Expert
Expert

I tried the script and below output is generated

pastedImage_0.png

Host column- i have excluded itin screenshot. 2 column is m issing here i.e. HBA-Module & HBA-version.

is it possible to get below information

          

Host NameTypeESXi BuildCluster Name FW System Rom FW iLO5FW Power Management ControllerHBA TypeHBA driver ver.HBA FW ver.
Host1Gen 108294253Cluster1I41 10/02/20181.37 Oct 25 20181.04QLogic1.0.45.37.13.109.0 BC: 7.15.24
Host2Gen 108294253 Cluster1I41 10/02/20181.37 Oct 25 20181.04QLogic1.0.45.37.13.109.0 BC: 7.15.24
Host3Gen 1010390116 Cluster3I41 08/08/20181.35 Aug 14 20181.04Emulex12.0.1115.012.0.1110.11
Host4Gen 1010884925Cluster3I41 10/02/20181.37 Oct 25 20181.04QLogic1.0.63.07.13.109.0 BC: 7.15.24
Host5Gen 1010884925 Cluster4I41 10/02/20181.37 Oct 25 20181.04Emulex12.0.1115.012.0.1110.11
Host6Gen 1010884925 Cluster1I41 10/02/20181.37 Oct 25 20181.04QLogic1.0.45.3 7.13.109.0 BC: 7.15.24
Host7Gen 1010884925Cluster5I41 10/02/20181.37 Oct 25 20181.04Emulexunable to log in
Host8Gen 108294253Cluster6I41 10/02/20181.37 Oct 25 20181.04QLogicno HBA values registered
Host9Gen 108294253 Cluster1I41 10/02/20181.37 Oct 25 20181.04QLogic1.0.45.3 7.13.109.0 BC: 7.15.24
Host10Gen 1010390116 Cluster1I41 08/08/20181.35 Aug 14 20181.04Emulex12.0.1115.012.0.1110.11
0 Kudos
Highlighted
User Moderator
User Moderator

The script filters on Emulex cards (the lpfc vib test).
Do you have those HBAs or did you leave that test out?


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

0 Kudos
Highlighted
Expert
Expert

LucD,

Above report, in earlier reply chain, I got it from a different team, but not sure how they were able to pull all this information. is it possible through script?

thanks

vmk

0 Kudos
Highlighted
User Moderator
User Moderator

Which script are you referring to?

Do you have a link?


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

0 Kudos
Highlighted
Expert
Expert

Sorry, LucD, these output provided by vulnerability team and I don't the script.

0 Kudos
Highlighted
User Moderator
User Moderator
0 Kudos
Highlighted
Expert
Expert

Ok LucD,

I got the clue-  Below CLI used on each ESXi host

/usr/lib/vmware/vmkmgmt_keyval/vmkmgmt_keyval -a

performed a detailed dump

0 Kudos
Highlighted
User Moderator
User Moderator

You can run this through a SSH connection.

When you have the Posh-SSH module you could do something like

$esxName = 'MyEsx'

$cmdSub = '/usr/lib/vmware/vmkmgmt_keyval/vmkmgmt_keyval -a'

$cred = Get-Credential -Message "Credentials for ESXi node $($esxName)"

$esx = Get-VMHost -Name $esxName


$session = New-SSHSession -ComputerName $esx.Name -Credential $cred –AcceptKey

$result = Invoke-SSHCommand -SSHSession $session -Command $cmdSub

Remove-SSHSession -SSHSession $session | Out-Null


$result.Output


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

0 Kudos
Highlighted
Expert
Expert

LucD,

It works. Can we extract this into notepad or csv because of the output on the screen difficult to read or either need to scroll pagewise? I will prefer in csv or notepad atleast.

0 Kudos
Highlighted
Expert
Expert

I guess since the output is large enough to capture and it will be better to redirect the output to notepad.  Also, can we pull for all host in a cluster  e.g. C:\temp\host.txt

thanks

vmk

0 Kudos
Highlighted
User Moderator
User Moderator

Try like this.

It assumes that the credentials you give are valid for each ESXi node.

$clusterName = 'MyCluster'

$cmdSub = '/usr/lib/vmware/vmkmgmt_keyval/vmkmgmt_keyval -a'


$cred = Get-Credential -Message "Credentials for all ESXi node in cluster $($clusterName)"


Get-Cluster -Name $clusterName | Get-VMHost |

ForEach-Object -Process {

   $session = New-SSHSession -ComputerName $_.Name -Credential $cred –AcceptKey

   $result = Invoke-SSHCommand -SSHSession $session -Command $cmdSub

   Remove-SSHSession -SSHSession $session | Out-Null

   $result.Output | Out-File -FilePath .\report.txt -Append

}


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

0 Kudos
Highlighted
Expert
Expert

LucD,

It throws an error. Also, in an earlier script, I need to give FQDN for each host to generate the output.

Also, it's strange despite getting an error, i can see the output report.

LucD, in the report, I don't see the host name so how  I'll correlate the output with the host name. It only shows WWPN.

pastedImage_0.png

0 Kudos
Highlighted
User Moderator
User Moderator

You might not have the permission to connect via SSH to one or more of the ESXi nodes.
We can use the FQDN of the ESXi nodes.

If we store the results in separate file, we can place the ESXi name in the filename.

Try like this

$clusterName = 'MyCluster'

$cmdSub = '/usr/lib/vmware/vmkmgmt_keyval/vmkmgmt_keyval -a'


$cred = Get-Credential -Message "Credentials for all ESXi node in cluster $($clusterName)"


Get-Cluster -Name $clusterName | Get-VMHost -PipelineVariable esx |

ForEach-Object -Process {

   $esxNet = Get-VMHostNetwork -VMHost $_

   $fqdn = "$($esxNet.HostName).$($esxNet.DomainName)"

   $session = New-SSHSession -ComputerName $fqdn -Credential $cred –AcceptKey

   $result = Invoke-SSHCommand -SSHSession $session -Command $cmdSub

   Remove-SSHSession -SSHSession $session | Out-Null

   $result.Output | Out-File -FilePath ".\report-$($fqdn).txt"

}


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

0 Kudos
Highlighted
Expert
Expert

Do  you mean to  say enable SSH and ESXi shell ? Also, to get output Hostname should be FQDN

0 Kudos