Get all ESXI details Powercli

Hi All.
I would like to share with you a wonderful script that knows providing your any prices of details about your ESXi’s Hots, such as:
Name, ESX version, make, Model, Serial

$myESXiHosts = Get-VMHost | %{ $_ | Select Name,
@{N="ESXi Version";E={"$($_.Version) build $($_.Build)"}},
@{N="vCenter";E={$_.cluster.Split('/')[2]}},
@{N="vCenter version";E={
$global:DefaultVIServers | 
where {$_.Name -eq ($_.ExtensionData.Client.ServiceUrl.Split('/')[2])} | 
%{"$($_.Version) build $($_.Build)"}
}},
@{N="Make";E={(Get-EsxCli -VMHost $_.Name).hardware.platform.get().VendorName}},
@{N="Model";E={(Get-EsxCli -VMHost $_.Name).hardware.platform.get().ProductName}},
@{N="Serial";E={(Get-EsxCli -VMHost $_.Name).hardware.platform.get().SerialNumber}}

}

$myESXiHosts | Export-csv C:\Esxi.csv
About Meir Peleg 339 Articles
My name is Meir Peleg, (Born 30/04/1991) live in ISRAEL. Live and breath IT world. Microsoft MVP Windows IT & VMware vExpert.