VMware Cloud Community
MukeshSingh92
Contributor
Contributor

BIO and firware Description

I tried the below and it works well to pull out those details for one host.

How can I loop if for multiple hosts (Not in vCenter).

**password for all hosts is same.

Get-View -ViewType HostSystem |

Select Name,

    @{N='BIOS Version';E={

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

        $script:biosTemp[0]}},

    @{N='BIOS Date';E={$script:biosTemp[1]}},

    @{N='Vendor';E={$_.Summary.Hardware.Vendor}},

    @{N='Serial';E={

        $esxcli = Get-EsxCli -VMHost $_.Name

        $esxcli.hardware.platform.get().SerialNumber

    }},

    @{N='BMC Firmware';E={$_.Runtime.HealthSystemRuntime.SystemHealthInfo.NumericSensorInfo | where{$_.Name -match 'BMC'} | Select -ExpandProperty Name}} |

Export-Csv E:\Biosreport.csv -NoTypeInformation -UseCulture

Tags (1)
0 Kudos
1 Reply
LucD
Leadership
Leadership

Try something like this.

You will have to provide a list of the ESXi hosts (FQDN or IP addresses), or at least provide a way to have all the ESXi node names in an array.

$esxNames = 'esx1','esx2','esx3'

$pswd = 'MyPassword'

$report = @()

for($esxName in $esxNames){

    Connect-VIServer -Server $esxName -User root -Password $pswd

    $report += Get-View -ViewType HostSystem |

    Select Name,

        @{N='BIOS Version';E={

            $script:biosTemp = ((($_.Runtime.HealthSystemRuntime.SystemHealthInfo.NumericSensorInfo |

                Where {$_.Name -like "*BIOS*"}).Name -split "BIOS ")[1] -split " ")

            $script:biosTemp[0]}},

        @{N='BIOS Date';E={$script:biosTemp[1]}},

        @{N='Vendor';E={$_.Summary.Hardware.Vendor}},

        @{N='Serial';E={

            $esxcli = Get-EsxCli -VMHost $_.Name

            $esxcli.hardware.platform.get().SerialNumber

        }},

        @{N='BMC Firmware';E={$_.Runtime.HealthSystemRuntime.SystemHealthInfo.NumericSensorInfo |

            where{$_.Name -match 'BMC'} | Select -ExpandProperty Name}}

    Disconnect-VIServer -Server $esxName -Confirm:$false

}

$report | Export-Csv E:\Biosreport.csv -NoTypeInformation -UseCulture 


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

0 Kudos