# encoding: ascii
# api: powershell
# title: Get-SerialNumber
# description: Get ESX server serial numbers.
# version: 0.1
# type: function
# author: Carter Shanklin
# license: CC0
# function: Get-SerialNumber
# x-poshcode-id: 5723
# x-archived: 2015-05-04T23:35:19
# x-published: 2015-02-03T10:39:00
#
#
function Get-SerialNumber {
	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
	}
}
