Hardware.SystemInfo.OtherIdentifyingInfo Blank in PowerCLI

Summary:
Using my PowerCLI script to get Dell warranty information, I noticed that some of my ESX hosts were not returning service/asset tag information.  The information was showing up in vCenter's hardware status tab, but not w/ my PowerCLI script.
Workaround:
  1. First, check to see if your ESX host has this information populated:
    • Connect-viServer ESXHostName
      $VMHost = Get-VMHost | Get-View
      $VMHost.Hardware.SystemInfo.OtherIdentifyingInfo

  2. If the above code returns objects, then the next step is to disconnect the host from vCenter, then reconnect it.  You can use the following PowerCLI code to find all hosts w/ empty properties to do this for you.  As always, test before you try it in a production environment.

    • $ESXHosts = @()
       
      $VMHosts = Get-VMHost | Get-View
      Foreach ($VMHost in $VMHosts)
      {
      $NewObj             = "" | Select Name, ServiceTag, AssetTag
      $NewObj.Name        = $VMHost.Name
      #Replace is used to clean up data that might be there for easier filtering
      $NewObj.ServiceTag    = ($VMHost.hardware.systeminfo.OtherIdentifyingInfo | where {$_.IdentifierType.Key -eq "servicetag"}).identifierValue -replace(" ","")
      $NewObj.AssetTag    = ($VMHost.hardware.systeminfo.OtherIdentifyingInfo | where {$_.IdentifierType.Key -eq "assettag"}).identifierValue -replace(" ","")
      $ESXHosts += $NewObj
      }
       
      $VMHostsFiltered = $ESXHosts | Where-Object {($_.ServiceTag -eq "" -or $_.AssetTag -eq "") -and ($_.ServiceTag -ne "unknown") -and ($_.AssetTag -ne "unknown")}
       
      Foreach ($EvilESXBox in $VMHostsFiltered)
      {
      Set-VMHost -VMHost $EvilESXBox.Name -State Disconnected
      Set-VMHost -VMHost $EvilESXBox.Name -State Connected
      }

  3. Now running the code in my Dell Warranty Script should have all information populated as long as the ESX host has the information.
FYI:  
If the assettag and servicetag fields are blank or unknown, it's likely that your server needs to be flashed by a Dell Technician to insert the service tag info.  It supposed to be pre-populated by the factory, but if you've had the motherboard replaced, then it needs to be flashed.

3 comments:

Anonymous said...

Nice info. But why do we have to disconnect/reconnect to get this info?

Chris Nakagaki said...

It is/was a bug in vCenter 4.x. Not sure if it followed in 5.x.

Herschelle42 said...

Thank you for the info. The disconnected and reconnect tricked worked for UCS Blades, running ESXi 5.1.