I'm trying to get the serial number of ESXi hosts. Get-View seems to be the only way to do it, but it only returns a serial number/service tag on 10% of my 700+ VMhosts. Is this a bug?
The server manufacturers are Cisco, IBM, and HP, but about 80% are Cisco UCS blades. What's weird is I may get a result with one Cisco UCS blade that is in the same Chassis with a blade that gets no result. I'm running mostly vCenter 5.0 with ESXi 5.0 build 804277.
Here's a script snippit:
Get-View -ViewType HostSystem -Property Name, Summary | select name, { $_.Summary.Hardware.OtherIdentifyingInfo | where {$_.IdentifierType.Key -eq "ServiceTag" } | % { $_.IdentifierValue } }
You can use esxcli.
$esxcli = get-vmhost Hostname | Get-EsxCli
$esxcli.hardware.platform.get().SerialNumber
I get the same (or lack of) result with Get-EsxCli.