Skip navigation

Rem: Retrieving a Computer’s Manufacturing Information

Downloads
46115.zip

How can I automate the retrieval of a computer's manufacturer and serial number?

The Windows Management Instrumentation (WMI) Win32_System
Enclosure class contains a series of properties related to the physical computer. Depending on the manufacturer, these properties might or might not contain relevant information. On my testing with Dell systems, the Manufacturer and SerialNumber properties contained the correct information. You can use the Windows Management Instrumentation Command-line (WMIC) tool or a script to retrieve these properties.

Retrieving the Manufacturer and SerialNumber properties with WMIC. The WMIC tool, which is available in Windows XP or later, provides a SystemEnclosure alias that makes it easy to retrieve the manufacturing information for a computer. To do this, simply use the following command syntax

wmic /node:computer
 systemenclosure
 get manufacturer, serialnumber

(Although this command appears on several lines here, you would enter it on one line in the command-shell window.) In this command, computer is the name of the computer you want to check. Although you can specify more than one computer, I don't recommend it. The output doesn't contain the computer names, so it's difficult to match the returned manufacturing information with the computer to which it belongs. If you omit the /node option, WMIC retrieves the information from the local computer. Although WMIC is available only on XP or later, you can still use it to query remote computers running earlier OSs (e.g., Windows 2000) that are running WMI.

Retrieving the Manufacturer and SerialNumber properties with a script. ManufacturingInfo.vbs in Listing 2 demonstrates how to use a script to retrieve the manufacturing information for a computer. The code at callout A in Listing 2 is the heart of the script. This code retrieves all instances of the Win32_SystemEnclosure class and stores the collection in the objEnclosures variable. The script then outputs the Manufacturer and SerialNumber properties from each instance of the class. (In this example, there's only one instance.) For more information about the Win32_SystemEnclosure class, go to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_systemenclosure.asp.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish