none
Wmi Script to get computer model number? RRS feed

  • Question

  • Hi,

    Been playing with WMI scripting to get details about a computer.  I'm able to get much of the good stuff like make and model name, installed Windows version, computer serial number, amount of RAM, hard drive make, model and size, etc.  But I'm not able to find the computer model number and I'm wondering if anyone can point me in the right direction or if it is even possible.

    I have tested on HP Desktops, Lenovo and Dell laptops and even Microsoft Surface Tablets but haven't found the model number anywhere yet.  And this is one of the pieces of information I am asked for when calling tech support.

    For example:  When I run my script of Win32_ComputerSystem it returns a model of 'HP EliteDesk 800 G3 DM 35W', which is helpful but I also want the model number, in this case it would be '1FY85UT'.  It isn't in Win32_ComputerSystem and it isn't in Win32_Bios, which is where I find the serial number.  Any other thoughts?

    Thanks in advance,

    Linn

    • Moved by Bill_Stewart Friday, January 26, 2018 2:44 PM This is not "research solutions for me" forum
    Friday, November 24, 2017 3:48 PM

All replies

  • Get-WmiObject win32_computersystem | select model,systemskunumber

    Not available on many consumer systems.  Contact HP for reference to utilities that can get the info required.


    \_(ツ)_/

    Friday, November 24, 2017 4:07 PM
  • Hi Linn,

    Using the following WMI queries will provide you with the model name and unique identifier for all of the brands you mentioned:

    	# Determine manufacturer
    	$ComputerManufacturer = (Get-WmiObject -Class Win32_ComputerSystem | Select-Object -ExpandProperty Manufacturer).Trim()
    
    	# Determine manufacturer name and hardware information
    	switch -Wildcard ($ComputerManufacturer) {
    		"*Microsoft*" {
    			$ComputerManufacturer = "Microsoft"
    			$ComputerModel = Get-WmiObject -Namespace root\wmi -Class MS_SystemInformation | Select-Object -ExpandProperty SystemSKU
    		}
    		"*HP*" {
    			$ComputerManufacturer = "Hewlett-Packard"
    			$ComputerModel = Get-WmiObject -Class Win32_ComputerSystem | Select-Object -ExpandProperty Model
    			$ModelID = (Get-CIMInstance -ClassName MS_SystemInformation -NameSpace root\WMI).BaseBoardProduct
    		}
    		"*Hewlett-Packard*" {
    			$ComputerManufacturer = "Hewlett-Packard"
    			$ComputerModel = Get-WmiObject -Class Win32_ComputerSystem | Select-Object -ExpandProperty Model
    			$ModelID = (Get-CIMInstance -ClassName MS_SystemInformation -NameSpace root\WMI).BaseBoardProduct
    		}
    		"*Dell*" {
    			$ComputerManufacturer = "Dell"
    			$ComputerModel = Get-WmiObject -Class Win32_ComputerSystem | Select-Object -ExpandProperty Model
    			$ModelID = (Get-CIMInstance -ClassName MS_SystemInformation -NameSpace root\WMI).SystemSku
    		}
    		"*Lenovo*" {
    			$ComputerManufacturer = "Lenovo"
    			$ComputerModel = Get-WmiObject -Class Win32_ComputerSystemProduct | Select-Object -ExpandProperty Version
    			$ModelID = ((Get-WmiObject -Class Win32_ComputerSystem | Select-Object -ExpandProperty Model).SubString(0, 4)).Trim()
    		}
    	}

    I hope that helps.

    Regards,

    Maurice Daly
    Microsoft MVP | Enterprise Mobility
    SCConfigmgr.com 

    Saturday, November 25, 2017 12:07 AM
  • Thanks for suggestion, jrv. Unfortunately systemskunumber returns blank on all of the different model computers we have here.

    I have talked to HP tech support in the past about this and they just said they don't support software development and couldn't help me.

    Thanks,

    Linn

    Monday, November 27, 2017 7:30 PM
  • Hi Maurice,

    Thanks for the information.  We mostly use HP EliteDesk computers so I tried out the HP section of code you provided and the BaseBoardProduct property returns a number but that doesn't relate to the actual model number on the computer.  At least not that I can find.

    Thanks for the information though,

    Linn

    Monday, November 27, 2017 7:33 PM
  • Been a while since I messed with HP systems, but I think it's OEMStringArray that you need to get info from:

    Get-WMIObject Win32_ComputerSystem | select OEMStringArray


    Jeremy Corbello | https://www.jeremycorbello.com

    Monday, November 27, 2017 7:43 PM
  • Thanks for suggestion, jrv. Unfortunately systemskunumber returns blank on all of the different model computers we have here.

    I have talked to HP tech support in the past about this and they just said they don't support software development and couldn't help me.

    Thanks,

    Linn

    HP does not add model to consumer level computers.  Only enterprise systems are tattooed with the model.   Some consumer systems like Envy may have the info.

    HP management software can retrieve the models on supported systems.


    \_(ツ)_/

    Monday, November 27, 2017 7:55 PM
  • Well we are using the EliteDesktops, which are bought through the business group.  Guess I thought those were enterprise class desktops, maybe not?

    My desktop is a Z320 Workstation, again, thought it would be an enterprise workstation but no luck there either.

    I thought I saw model_number in the properties list for Win32_Bios but can't find it now.  But it was empty though, so maybe they don't populate that for many computers.

    Thanks,

    Linn

    Monday, November 27, 2017 8:59 PM
  • Hi Jeremy,

    Thanks for the suggestion and OEMStringArray does contain quite a bit of data but I don't see anywhere in there that it contains the model number.

    Thanks,

    Linn

    Monday, November 27, 2017 9:05 PM
  • Yeah, that was a long shot. Just for giggles, do you get the data when you run this?

    wmic csproduct
    I'm more curious if it exists at all. I have an EliteBook at the house, I'll take a look at it when I get home and see if I can recreate the issue.


    Jeremy Corbello | https://www.jeremycorbello.com

    Monday, November 27, 2017 9:08 PM
  • Those are business class workstations but you likely don't have the WMI support installed.  This happens when re-imaging a vendor product against a standard I mage and forgetting to detect the vendor and adding vendor support software.

    Here is the 64bit WMI support package for you WS: https://ftp.hp.com/pub/caps-softpaq/cmit/softpaq/sp79022.exe

    This is the link to the page with the HP drivers and management support software: http://www8.hp.com/us/en/ads/clientmanagement/download.html


    \_(ツ)_/

    Monday, November 27, 2017 9:42 PM