«

Apr 09

How to: Find the HP Product Number of all your HP server using powershell

You can easly find the HP product number of any of your HP server by looking on the server itself or on the warranty card.
The HP product number is nice to have if you want to easily find that date your HP server will be out of warranty.

This product number is no longer mandatory if you are using this Warranty check tool, but in some case you will still need it.
 

If your HP server was built using HP SmartStart the product number could be found in the windows registry:
HKLM\HARDWARE\DESCRIPTION\System\BIOS\SystemSKU
 

Here is how to use powershell to read this information:

#Read HP product number from registry
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', "NameOfServer")
$regkey = $reg.OpenSubkey("HARDWARE\\DESCRIPTION\\System\\BIOS")
$SystemSku = $regkey.GetValue("SystemSku")


This could easily be part of a small script that would allow you to get more information about your servers:

$Servers = Get-content "C:\list.txt"

foreach($Server in $Servers){

    #Read HP product number from registry
    $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $Server)
    $regkey = $reg.OpenSubkey("HARDWARE\\DESCRIPTION\\System\\BIOS")
    $SystemSku = $regkey.GetValue("SystemSku")

    #Get Manufacturer, Model, SerialNumber from WMI query
    $HardwareInfo = Get-WmiObject win32_computersystem -ComputerName $Server
    $SerialNumber = Get-WmiObject win32_bios -ComputerName $Server

    #Create a CSV file with Inventory information
    $Server + "," + $HardwareInfo.Manufacturer + "," + $HardwareInfo.Model + "," + $SerialNumber.SerialNumber.Trim() + "," + $SystemSku | Add-Content C:\inv.csv


    Remove-Variable REG, regkey, SystemSku
    Remove-Variable HardwareInfo, SerialNumber, Server
}
Remove-Variable Servers

Explanation:
-Put all your physical HP servers running windows in c:\list.txt
-Run the script (Copy/Paste) saved in a PS1 file
-Output will be in C:\inv.csv

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>