VMware Cloud Community
T180985
Expert
Expert
Jump to solution

Getting hardware product ID & Serial number

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

Please mark helpful or correct if my answer resolved your issue. How to post effectively on VMTN https://communities.vmware.com/people/daphnissov/blog/2018/12/05/how-to-ask-for-help-on-tech-forums
Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos
6 Replies
LucD
Leadership
Leadership
Jump to solution

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: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
T180985
Expert
Expert
Jump to solution

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

Please mark helpful or correct if my answer resolved your issue. How to post effectively on VMTN https://communities.vmware.com/people/daphnissov/blog/2018/12/05/how-to-ask-for-help-on-tech-forums
Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
T180985
Expert
Expert
Jump to solution

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 Smiley Happy

Please mark helpful or correct if my answer resolved your issue. How to post effectively on VMTN https://communities.vmware.com/people/daphnissov/blog/2018/12/05/how-to-ask-for-help-on-tech-forums
Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
T180985
Expert
Expert
Jump to solution

I ended up using:

$esx.ExtensionData.Hardware.SystemInfo.OtherIdentifyingInfo |

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

Select -ExpandProperty IdentifierValue

Thanks again

Please mark helpful or correct if my answer resolved your issue. How to post effectively on VMTN https://communities.vmware.com/people/daphnissov/blog/2018/12/05/how-to-ask-for-help-on-tech-forums
Reply
0 Kudos