# encoding: ascii
# api: powershell
# title: Get-VMHostSerialNumber
# description: Get ESX server serial numbers.
# version: 0.1
# type: function
# author: Carter Shanklin
# license: CC0
# function: Get-VMHostSerialNumber
# x-poshcode-id: 1341
# x-derived-from-id: 5349
# x-archived: 2015-01-26T04:27:42
# x-published: 2010-09-23T10:43:00
#
#
function Get-VMHostSerialNumber {
param([VMware.VimAutomation.Types.VMHost[]]$InputObject = $null)
process {
$hView = $_ | Get-View -Property Hardware
$serviceTag = $hView.Hardware.SystemInfo.OtherIdentifyingInfo | where {$_.IdentifierType.Key -eq "ServiceTag" }
$assetTag = $hView.Hardware.SystemInfo.OtherIdentifyingInfo | where {$_.IdentifierType.Key -eq "AssetTag" }
$obj = New-Object psobject
$obj | Add-Member -MemberType NoteProperty -Name VMHost -Value $_
$obj | Add-Member -MemberType NoteProperty -Name ServiceTag -Value $serviceTag.IdentifierValue
$obj | Add-Member -MemberType NoteProperty -Name AssetTag -Value $assetTag.IdentifierValue
Write-Output $obj
}
}