VMware Cloud Community
Ayan1
Contributor
Contributor

ESXi hosts BIOS version With Cluster Details

I am trying to pull BIOS version of all the ESXi hosts in my environment. I am using the below script which is giving me the Hostname/BIOS version and BIOS date only. But I want to add another column where cluster name also will show for each host. Any idea?

$report = @()

Get-View -ViewType HostSystem | %{

     $row = "" |Select Name, "BIOS Version", "BIOS Date"

     $row.name = $_.name

     $biosTemp = ((($_.Runtime.HealthSystemRuntime.SystemHealthInfo.NumericSensorInfo | Where {$_.Name -like "*BIOS*"}).Name -split "BIOS ")[1] -split " ")

     $row."BIOS Version" = $biosTemp[0]

     $row."BIOS Date" = $biosTemp[1]

     $report += $row

}

$report

Tags (1)
Reply
0 Kudos
2 Replies
losisoft
Contributor
Contributor

maybe like this?


$HostsVer = @()

foreach ($clusview in $clusviews) {

$HostsVerMiss = $HostsViews | ?{ $_.Parent -match $clusview.MoRef} | select @{N="FullName";E={$_.Config.Product.FullName}} -Unique

if (($HostsVerMiss | Measure-Object).Count -gt 1) {

  $allVer = ""

  foreach ($Ver in $HostsVerMiss) { $allVer = $allVer + $Ver.FullName + ";" }

  $Details = "" | Select-Object Cluster, Ver

  $Details.Cluster = $clusview.name

  $Details.Ver = "*mismatch* " + $allVer.Substring(0, $allVer.Length-1)

  $HostsVer += $Details

} elseif (($HostsVerMiss | Measure-Object).Count -eq 1) {

  $Details = "" | Select-Object Cluster, Ver

  $Details.Cluster = $clusview.name

  $Details.Ver = $HostsVerMiss.FullName

  $HostsVer += $Details

}

}

Reply
0 Kudos
grasshopper
Virtuoso
Virtuoso

Hi Ayan1,

Please note that there is a new cmdlet (Get-VMHostHardware) that is handles this nicely.  It's available as of PowerCLI 6.0 R2 and later (backwards compatible to vSphere 5.0)

Supporting Links:

Audit and Manage ESXi Hosts with PowerCLI - VMware PowerCLI Blog - VMware Blogs

Download PowerCLI

Reply
0 Kudos