How do I obtain the computer manufacturer’s name?

Raymond Chen

One customer wanted a way to determine the name of the computer manufacturer. For example, they wanted to make some function call and get back “IBM” or “Compaq” or “Dell”. I don’t know why they wanted this information, and for the moment, I don’t care.

And of course, when you’re looking for information, you don’t search MSDN; that’s for crazy people. No, let’s just fire up regedit and hit Ctrl+F. (I can’t imagine how many application compatibility bugs were created by that “helpful” Ctrl+F dialog in regedit.)

The customer found the registry keys that are used to customize the System control panel, as well as the OEMINFO.INI file that also takes part. But then the question of reliability arose. After all, since it’s just a registry key and an INI file, the user could just edit it and make it say anything they want. If the customer wiped their hard drive and reinstalled Windows from scratch, then this information would be lost, too. This customer wanted some degree of assurance that if the computer claimed to be a Dell, then it really was a Dell.

Enter WMI. The Scripting Guys are all over WMI. If you search for the phrase “from Win32_ComputerSystem” you will find hit after hit from the Hey, Scripting Guy! column.

And it so happens that WMI exposes the computer manufacturer info as well. If you look at the scripts that the Scripting Guys put out, probably two thirds of them fall into this pattern:

strComputer = “.”
Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\cimv2”)
Set colItems = objWMIService.ExecQuery(“Select * from something“)
For Each objItem in colItems
     Wscript.Echo objItem.something

All we have to do is fill in the “something”.

strComputer = “.”
Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\cimv2”)
Set colItems = objWMIService.ExecQuery(“Select * from Win32_ComputerSystem“)
For Each objItem in colItems
     Wscript.Echo “System Name: ” & objItem.Name
     Wscript.Echo “Manufacturer: ” & objItem.Manufacturer
     Wscript.Echo “Model: ” & objItem.Model

Okay, so great, we can use WMI to get this information. But how reliable is it?

Well, the WMI folks tell me that they get the information by querying the SMBIOS directly, so it’s as reliable as your BIOS. Major manufacturers will put their names into the BIOS¹, but if you’re running on a home-built machine, the values are whatever came with your motherboard. The BIOS manufacturers typically put placeholder strings into their SMBIOS, setting the manufacturer to a generic string like “Manufacturer”, for example. When the motherboard manufacturer installs the BIOS, they’re supposed to replace the placeholder strings with something more meaningful, but most of them don’t bother. The result is that a machine you put together from parts you bought at the local computer shop will most likely just say “Manufacturer” for the manufacturer.

In summary, if you query WMI for the computer manufacturer and it comes back “Dell”, then you can be pretty sure you have a Dell. (Either that or somebody with way too much time on their hands burned a custom BIOS that says “Dell”.) On the other hand, if it comes back as “Manufacturer” then you’re still in the dark. All you know is you’ve got some sort of generic computer.

¹Even though major manufacturers will put their name into the BIOS, I’m told that if you send your computer back to the manufacturer and they replace the motherboard, they will sometimes forget to burn their name into the BIOS of the replacement motherboard. As a result, even on a name-brand computer, you might see “Manufacturer”.


Discussion is closed.

Feedback usabilla icon