Random Post: VCAP-DCD Round-Up
RSS .92| RSS 2.0| ATOM 0.3
  • Home
  •  

    PowerCLI: Get HP DL server Serial Number via vCenter and iLO

    Need a quick and easy way to get the serial numbers from you ESXi servers running on HP hardware?

    Fire up this code (snagged and modified from a vmware community post by RvdNieuwendijk.

    Prerequisites:

    • You have an iLO configured on each server, and online
    • You have vCenter access
    # change the variable to whatever you name your iLO
    # example: -iLO or -OA etc
    $ilo="-ilo"
    get-vmhost | where-object {_.Manufacturer -eq "HP" } | \
    sort-object -Property Name | %{
    
     # Since your ESXi box is attached to vCenter by FQDN,
     # we split the string on "." and take the first
     # element [0] which is the server's short name
     $shortname = ($_.name.split(".")[0])
    
     $xml = new-object system.xml.xmldocument
     # add together $shortname and $ilo to get "server-ilo"
     $xml.load("https://$shortname$ilo/xmldata?item=ALL")
    
     new-object psobject -property @{
       "Name" = $shortname
       # Parse the XML and only grab the server serial number
       "SN" = $xml.RIMP.HSI.SBSN
       }
    }
    
    

    Leave a Reply

    Your email address will not be published. Required fields are marked *