6 Replies Latest reply on Feb 26, 2020 5:04 AM by T180985

    Getting hardware product ID & Serial number

    T180985 Expert

      Im trying to pull a vmhosts product ID & Serial number, i have been able to get the serial number using the following:

       

      $esxcli = Get-EsxCli -VMhost HostName -V2

      $esxcli.hardware.platform.get.Invoke() | Select @{N='VMHost';E={$esxcli.VMHost.Name}},SerialNumber

      However i cant seem to find the option for Product ID using get-esxcli... if i run the below command i get the product ID among other entries:

       

      (get-vmhost HostName | get-view).hardware.systeminfo.OtherIdentifyingInfo

       

      Is it possible to separate out Product ID from the list so it can be included with the serial number? They all appear to have the same identifier type

        • 1. Re: Getting hardware product ID & Serial number
          LucD Guru
          Community WarriorsUser ModeratorsvExpert

          Not too sure what you mean by Product ID.
          Is it the HW model?

           

          Get-VMHost | Select Name,

              @{N='Model';E={$_.ExtensionData.Hardware.SystemInfo.Model}}

          Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
          • 2. Re: Getting hardware product ID & Serial number
            T180985 Expert

            So i managed to get the product name e.g. "ProLiant DL380p Gen8" but i want the ID e.g "Product ID: 642121-421"

            With the get-view command i get the following list:

             

            IdentifierValue                                                 IdentifierType

            ---------------                                                 --------------

            0****                                                                VMware.Vim.ElementDescription

            CZ********                                                        VMware.Vim.ElementDescription

            CZ********                                                       VMware.Vim.ElementDescription

            CZ********                                                       VMware.Vim.ElementDescription

            PSF:                                                               VMware.Vim.ElementDescription

            Product ID: 642121-421                               VMware.Vim.ElementDescription

             

            The ID would be more useful to support when logging support tickets etc

            • 3. Re: Getting hardware product ID & Serial number
              LucD Guru
              vExpertCommunity WarriorsUser Moderators

              These entries normally have a Key, which you can use to retrieve the desired entry.

              First list the available keys and values.

               

              $esx = Get-VMHost -Name MyEsx

              $esx.ExtensionData.Hardware.SystemInfo.OtherIdentifyingInfo |

              ForEach-Object -Process {

                  [PSCustomObject]@{

                      Key = $_.IdentifierType.Key

                      Value = $_.IdentifierValue

                  }

              }

               

              Then you can use the Key to retrieve the desired entry.

               

              $esx = Get-VMHost -Name MyEsx

              $tgtKey = '<Key>'


              $esx.ExtensionData.Hardware.SystemInfo.OtherIdentifyingInfo |

              where{$_.IdentifierType.Key -eq $tgtKey} |

              Select -ExpandProperty IdentifierValue

              Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
              • 4. Re: Getting hardware product ID & Serial number
                T180985 Expert

                Annoyingly there are 2 keys with the same name "OemSpecificString" but that first command to find the key names will be massively useful in future, thanks for that

                • 5. Re: Getting hardware product ID & Serial number
                  LucD Guru
                  User ModeratorsvExpertCommunity Warriors

                  If the Product ID has a specific format, you could use a -match with a RegEx to find the correct entry.

                  Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                  • 6. Re: Getting hardware product ID & Serial number
                    T180985 Expert

                    I ended up using:

                     

                    $esx.ExtensionData.Hardware.SystemInfo.OtherIdentifyingInfo |

                    where{$_.IdentifierType.Key -eq $tgtKey -and $_.IdentifierValue -like "Product*"} |

                    Select -ExpandProperty IdentifierValue

                     

                    Thanks again