ESX Host Serial Numbers

Get Serial numbers for Hosts from PowerCLI

http://www.vroem.co.za/?p=524

http://poshcode.org/1337

Get-Vmhost vmhostname | Get-View | select @{Name="Serial Number"; Expression={($_.Hardware.SystemInfo.OtherIdentifyingInfo | where {$_.IdentifierType.Key -eq “ServiceTag”}).IdentifierValue}}

$foo =Get-Vmhost vmhostname | Get-View $foo.Hardware.SystemInfo.OtherIdentifyingInfo | where {$_.IdentifierType.Key -eq “ServiceTag” } | select IdentifierValue

$hostname = Get-View -ViewType HostSystem -property name,Hardware.SystemInfo foreach ($hname in $hostname) { $hn = $hname.name $Man = $hname.Hardware.SystemInfo.Vendor $Mod = $hname.Hardware.SystemInfo.Model $serviceTag = $($hname.Hardware.SystemInfo.OtherIdentifyingInfo | where {$_.IdentifierType.Key -eq “ServiceTag” }).IdentifierValue  $hname | Add-Member -MemberType NoteProperty -Name VMHost -Value $hn $hname | Add-Member -MemberType NoteProperty -Name OEM -Value $Man $hname | Add-Member -MemberType NoteProperty -Name Model -Value $Mod $hname | Add-Member -MemberType NoteProperty -Name ServiceTag -Value $serviceTag }  $hostname | select VMHost, OEM, Model, ServiceTag 

http://tech.zsoldier.com/2011/08/hardwaresysteminfootheridentifyinginfo.html

Serial numbers not showing in powercli but display in vCenter Console.

VM Guest Serial numbers

Conveniently somebody already created this :)

http://www.peppercrew.nl/index.php/2011/04/get-virtual-machine-bios-serial-number/ 

  

function Get-VMSerial {   param([VMware.VimAutomation.ViCore.Impl.V1.Inventory.VirtualMachineImpl]$VirtualMachine)   $s = ($VirtualMachine.ExtensionData.Config.Uuid).Replace("-", "")   $Uuid = "VMware-"   for ($i = 0; $i -lt $s.Length; $i += 2)   {     $Uuid += ("{0:x2}" -f [byte]("0x" + $s.Substring($i, 2)))     if ($Uuid.Length -eq 30) { $Uuid += "-" } else { $Uuid += " " }   }    Write-Output $Uuid.TrimEnd() }

$VM = Get-VM MyVirtualMachine Get-VMSerial -VirtualMachine $VM