I'm currently working on some reporting functions and I want to include host service tag / serial number information. This seems to do it (and it works with my three HP Proliant servers):
New-VIProperty -Name ServiceTag -ObjectType VMHost -Value {
param($vmhost)
($VMHost.Extensiondata.hardware.SystemInfo.OtherIdentifyingInfo | where {$_.IdentifierType.Key -eq "ServiceTag"}).IdentifierValue
}
It adds a ServiceTag property to the output of Get-VMHost. I'd like to know how well this works with other systems.
It depends on how the HW vendor has implemented this.
And for the same HW vendor it will also depend on the specific model.
In my experience, a better way, or at least a more standardised one, would be to use the CIM interface.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
It depends on how the HW vendor has implemented this.
And for the same HW vendor it will also depend on the specific model.
In my experience, a better way, or at least a more standardised one, would be to use the CIM interface.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks for answering. I haven't used the CIM interface yet but I've seen some posts about it - now I have to actually READ them ( I think that was about getting ILO IP).
Have a look at Re: Query ESXi hostname & DELL Service Tag
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
That works.
But it does require a direct login into the ESXi host and I really don't want to do that (compliance... auditors...).
But I found:
http://blogs.vmware.com/PowerCLI/2009/03/monitoring-esx-hardware-with-powershell.html
So I could use:
foreach ($vmhost in get-vmhost) {Get-VMHostWSManInstance -VMHost $vmhost -ignoreCertFailures -class CIM_PhysicalFrame | select @{N="Name";E={$vmhost.Name}},SerialNumber}
More fun:
foreach ($vmhost in get-vmhost) {
$CIM_PhysicalFrame = Get-VMHostWSManInstance -VMHost $vmhost -ignoreCertFailures -class CIM_PhysicalFrame
$OMC_IPMIIPProtocolEndpoint = Get-VMHostWSManInstance -VMHost $vmhost -ignoreCertFailures -class OMC_IPMIIPProtocolEndpoint
New-Object -TypeName PSObject -Property @{
Name = $vmhost.Name
SerialNumber = $CIM_PhysicalFrame.SerialNumber
iLO_IPv4 = $OMC_IPMIIPProtocolEndpoint.IPv4Address
iLO_MAC = $OMC_IPMIIPProtocolEndpoint.MACAddress
} | select Name, SerialNumber, iLO_IPv4, iLO_MAC
}
That is correct, Carter's function reuses your vCenter session token to make the connection.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference