Reply to Message

View discussion in a popup

Replying to:
RonPSSC
Enthusiast
Enthusiast

PowerCLI Help Needed With Retrieving ESXi Host Asset Tag Info

Hoping someone, anyone, will be able to help me figure out what I may be doing wrong and how to use PowerCLI to retrieve valid ESXi host Asset Tag information that is displayed on the Hardware Status Tab in vCenter. I have absolutely no issues retrieving Host Serial Numbers (sometimes referred to as Service Tags), Manufacture, Model, Part, Build Numbers, etc, but can't seem to be able to poll current Asset Tag Numbers.

None of the following attributes or property values identified below returned the information required and which currently exists (See image below):

Hardware.SystemInfo.OtherIdentifyingInfo[0].IdentifierValue

Hardware.SystemInfo.OtherIdentifyingInfo[1].IdentifierValue

Hardware.SystemInfo.OtherIdentifyingInfo[2].IdentifierValue

Hardware.SystemInfo.OtherIdentifyingInfo | where {$_.IdentifierType.Key -eq "assettag"}).identifierValue

vCenter Server Hardware Status Tab - Asset Tag Info.png

This is the script I'm currently running. I'm using PowerCLI Version 5.1:

$VIServer = "Enter vCenter Server Name"


# Adding PowerCLI core snapin
if (!(get-pssnapin -name VMware.VimAutomation.Core -erroraction silentlycontinue)) {
add-pssnapin VMware.VimAutomation.Core
}

Connect-VIServer $VIServer

$HostReport = @()

$VMH = Get-VMHost | Get-View |%{    

     $Report = "" | select Hostname, Version, Build, Manufacture, Model, Serial, Asset Tag

     $Report.Hostname = $_.Name

     $Report.version =$_.Config.Product.Version

     $Report.Build =$_.Config.Product.Build

     $Report.manufacture =$_.Hardware.SystemInfo.Vendor

     $Report.Model =$_.Hardware.SystemInfo.Model

     $Report.Serial =$_.Hardware.SystemInfo.OtherIdentifyingInfo[0].IdentifierValue

     $Report.Asset Tag =????????????????????????

     $HostReport += $Report
     
}

$HostReport | Export-Csv ".\HostReport.csv" –NoTypeInformation

Disconnect-VIServer -Confirm:$false

Thx. Ron