Posts Tagged ‘HP SerialNumber’

Finding the HP product number of any of your HP servers using PowerShell.

You can easily 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 warranty check tool, but in some case you will still need it.
If your HP server was built using HP SmartStart (or the newer HP Intelligent Provisioning) the product number could be found in the windows registry:


Here is how to use PowerShell to read this information:

$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:\server_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:\inventory.csv

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

-put all your HP servers names (or IP addresses) running MS operating systems in c:\server_list.txt
-run the script (Copy/Paste) saved in a PS1 file
-output will be in C:\inventory.csv

It turns out that above script works even if your HP server was installed without HP SmartStart or HP Intelligent Provisioning. Moreover – the script works with every HP laptop/PC with MS Windows.