8

I have put together a robust HP Warrant Lookup PowerShell script. However, I cannot figure out how to get a HP system's product number in an automated process. So...

How can I get HP product number (not the serial number) via PowerShell? Although I would like to do with only built-in out-of-the-box Windows and PowerShell commands, I am open to other ideas. In the end, the ultimate goal is retrieve the product number in the most reliable and least invasive way possible (i.e. installing 3rd software).

Troubleshooting

Tried:

Get-WmiObject Win32_ComputerSystem | Select-Object OEMStringArray

Result:

{ABS 70/71 79 7A 7B 7C, CMS v01.4A, HP_Mute_LED_0, www.hp.com}

... But expecting to find XT908UT#ABA

6
  • Is the product number you were expecting listed when running either of the following commands? wmic csproduct list /format:list / wmic computersystem list /format:list
    – and31415
    Feb 8, 2014 at 15:36
  • Nope. I am pretty sure it's stored in SMBios, but I don't know a reliable way to retrieve it.
    – SgtOJ
    Feb 8, 2014 at 21:56
  • 1
    This article says that the number is in the registry at HKLM\HARDWARE\DESCRIPTION\System\BIOS\SystemSKU so can be retrieved in PowerShell. This one says wmic /namespace:\\root\wmi path MS_SystemInformation. Does any of these work for you?
    – harrymc
    Feb 10, 2014 at 20:56
  • On a Dell computer I can use Get-WmiObject Win32_BIOS | Select-Object SerialNumber (I have no HP to test this on).
    – harrymc
    Feb 10, 2014 at 21:22
  • @harrymc - Looks like the registry and MS_SystemInformation is a go! Thanks, you should post it answer answer. I am disappointed in myself because I did come across the same article (registry method) but blew it off.
    – SgtOJ
    Feb 10, 2014 at 23:16

6 Answers 6

10
+250

Here are some methods that work for various computer models.

Method 1 : Registry

The HP product number is in the registry so can be retrieved in PowerShell HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS item SystemSKU.

More information and script can be found in the article :
How to: Find the HP Product Number of all your HP server using powershell.

Method 2 : root\wmi – MS_SystemInformation

Class MS_SystemInformation contains the product number in its member SystemSKU.
(Presumably it gets it from the registry as in the first method.)

For more info see Richard Siddaway's Blog.

Method 3 : Class Win32_BIOS

The following fragment finds the product number for some computer makes. Tested on Dell.

Get-WmiObject Win32_BIOS | Select-Object SerialNumber

The Microsoft reference information is found in the article Win32_BIOS class.

1
  • 1
    The Win32_BIOS class does have the serial number, but that's different than HP's product number (P/N). Which I have recently discovered is call System SKU by Microsoft and Product SKU by SMBios. The registry and MS_SystemInformation class does store this P/N I am looking for.
    – SgtOJ
    Feb 11, 2014 at 9:52
2

This is tested on a HP Laptop. I think HP "Product number" is called SystemSKUNumber in win32_computersystem WMI. Tested on my HP laptop.

Get-WmiObject win32_computersystem | Select-Object SystemSKUNumber

Will result in:

SystemSKUNumber
---------------
J9A12EA#ABN
0

If anyone else comes across this question, be advised, the entirety of win32_computersystem doesn't appear to contain the product number for servers, specifically. I was unable to actually find the information via WMI, but it turns out I was actually given the product number AND serial numbers for a number of servers (the spreadsheet was horribly formatted, so the two fields just looked like one big string until my afternoon coffee kicked in).

0
$PN = (Get-WmiObject -Namespace Root\wmi MS_SystemInformation -ComputerName $PC -ErrorAction SilentlyContinue ).SystemSKU

Write-host $PN
1
  • Consider adding some reference to this answer supporting what you state to explain why this works. Aug 1, 2017 at 12:50
0

Works on Windows 7 & Windows 10 From another user that posted. @harrymc

#Open Powershell and type the following. 
$Server='ComputerName'
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $Server)
$regkey = $reg.OpenSubkey("HARDWARE\\DESCRIPTION\\System\\BIOS")
$SystemSku = $regkey.GetValue("SystemSku")

$SystemSku

or try

$Server='ComputerName'

Get-WmiObject -ClassName CIM_System -ComputerName $Server| Select-object -ExpandProperty SystemSKUNumber

$Server can be directly replaced by a ComputerName. example...

Get-WmiObject -ClassName CIM_System -ComputerName PC001 | select SystemSKUNumber

Keep in mind if you are on a domain you may need to provide credentials by either using an invoke-command or -credential parameter.

Get-WmiObject -Credential Domain\UserID -ClassName CIM_System -ComputerName $Server

or

Invoke-Command -Credential Domain\UserID -ComputerName PC001 -ScriptBlock {Get-WmiObject -Credential -ClassName CIM_System}

if WinRm is not configured on client, you may experience issues.

1
  • the Get-CIMInstance -ClassName CIM_System | Select-object -ExpandProperty SystemSKUNumber have provided me HP product number 7QE59EA#ACB for local laptop but the HP site has accepted the 7QE59EA only
    – oleksa
    Nov 5, 2021 at 11:57
0

simply from cmd line:

wmic /namespace:\\root\wmi path MS_SystemInformation
2
  • This is one of the things the selected answer already suggests. Please avoid additional answers unless they give substantial unique information not already given in other answers. Apr 6, 2022 at 3:46
  • It actually was NOT in the accepted answer. That's why I created another answer. But, I did now edit the accepted answer to include it.
    – Mike
    Apr 6, 2022 at 17:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .