Retrieving Identifying Information by Using the SMBIOS

Microsoft® Windows® 2000 Scripting Guide

microsoft windows 2000 scripting guide

« Previous | Next »   

Computers are typically identified by name. This practice provides a convenient way to distinguish one computer from another, but it is not always sufficient for uniquely identifying computers; after all, computer names are easily, and often, changed. To track individual computers, you should always use a more immutable identifier, such as the serial number or the asset tag number.

The SMBIOS specification enables manufacturers to store extended information in the BIOS, including unique identifiers such as the serial number and the asset tag number. Retrieving the serial number or the asset tag number can help identify a specific computer. For example, each computer has a unique serial number that does not change unless the BIOS is replaced. Because you are far less likely to replace a BIOS than to rename a computer, the BIOS serial number provides a good way to identify computers.

Identifying information such as serial number and asset tag can be retrieved from a computer by using the WMI Win32_SystemEnclosure class.

Note

  • A number of third-party tools can also retrieve extended BIOS information. However, most of these tools are hardware-specific; before the SMBIOS specifications were completed, many hardware manufacturers stored the serial number and asset tag in nonstandard formats. The Win32_SystemEnclosure class can generally retrieve this information, even if it has been stored in a nonstandard way.

Table 8.3 lists the SMBIOS-related properties of the Win32_SystemEnclosure class.

Table 8.3   Win32_SystemEnclosure Properties

PropertyDescription
PartNumberPart number assigned by the organization responsible for producing or manufacturing the computer.
SerialNumberManufacturer-allocated number used to identify the computer.
SKUStock-keeping unit number for the computer.
SMBIOSAssetTagAsset tag number of the computer.

Scripting Steps

Listing 8.3 contains a script that retrieves identifying information for a computer. To carry out this task, the script must perform the following steps:

  1. Create a variable to specify the computer name.
  2. Use a GetObject call to connect to the WMI namespace root\cimv2, and set the impersonation level to "impersonate."
  3. Use the ExecQuery method to query the Win32_SystemEnclosure class.

    This query returns a collection consisting of the physical properties of the computer and its housing.

  4. Echo the values for PartNumber, SerialNumber, and SMBIOSAssetTag.

Listing 8.3   Retrieving Identifying Information

1 2 3 4 5 6 7 8 9 10 
strComputer = "." Set objWMIService = GetObject("winmgmts:" _     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colSMBIOS = objWMIService.ExecQuery _     ("SELECT * FROM Win32_SystemEnclosure") For Each objSMBIOS in colSMBIOS     Wscript.Echo "Part Number: " & objSMBIOS.PartNumber     Wscript.Echo "Serial Number: " & objSMBIOS.SerialNumber     Wscript.Echo "Asset Tag: " & objSMBIOS.SMBIOSAssetTag Next

send us your feedback Send us your feedback « Previous | Next »   


Microsoft Windows 2000 Scripting Guide(c) Automating System Administration 2003
Microsoft Windows 2000 Scripting Guide(c) Automating System Administration 2003
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 635

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net