Retrieving Information About the BIOS

Microsoft® Windows® 2000 Scripting Guide

Each computer has a BIOS that is used to configure basic computer settings, including fundamental properties such as whether a password is required to start the computer and how memory can be configured. The BIOS also helps determine which hardware can be installed on a computer. For example, before you can add a new CPU or a new motherboard to a computer, you must make sure the computer has the correct version of the BIOS.

BIOS manufacturers routinely issue BIOS upgrades that enable a computer to support new classes of hardware or that add features to the computer. Before installing such an upgrade, you must know which version of a BIOS has been installed on a computer. Attempting to add hardware to a computer that does not support this hardware can cause serious problems. Problems can also occur if you attempt to install a BIOS upgrade on a computer that does not use that particular BIOS to begin with.

Note

  • The make and model of a computer are not always indicative of which BIOS has been installed on that computer. Two seemingly identical computers from the same manufacturer might use different BIOS.

You can use the Win32_BIOS class to enumerate the properties of the BIOS installed in your computer. Table 8.2 lists some of the more commonly used properties of the Win32_BIOS class, including properties related to the installed version of SMBIOS.

Table 8.2 Win32_BIOS Properties

Property

Description

BIOSCharacteristics

Array of BIOS characteristics supported by the computer as defined by the SMBIOS Reference Specification. The possible values for this property are:

3 - BIOS characteristics not supported

4 - ISA is supported

6 - EISA is supported

7 - PCI is supported

8 - PC Card (PCMCIA) is supported

9 - Plug and Play is supported

10 - APM is supported

11 - BIOS is upgradable (flash)

15 - Boot from CD is supported

16 - Selectable boot is supported

17 - BIOS ROM is socketed

18 - Boot from PC card (PCMCIA) is supported

32 ACPI supported

34 AGP is supported

BuildNumber

Internal identifier for the BIOS.

CurrentLanguage

Name of the current BIOS language.

InstallableLanguages

Number of languages available for installation on this computer.

Manufacturer

Manufacturer of the BIOS.

Name

Name used to identify the BIOS.

PrimaryBIOS

Indicates whether this is the primary BIOS of the computer.

ReleaseDate

Release date of the BIOS. Dates are in the Universal Time Coordinate (UTC) format yyyymmddHHMMSS.xxxxxx-UUU, where:

  • yyyy represents the year

  • mm represents the month

  • dd represents the day

  • HH represents the hour (in 24-hour time format)

  • MM represents the minutes

  • SS represents the seconds

  • xxxxxx represents the milliseconds

  • UUU represents the number of minutes to be subtracted from the current time in order to calculate Greenwich Mean Time

For example, a BIOS released on October 31, 2002, at 10:45:39 A.M. Pacific time looks like this:

SerialNumber

Serial number assigned to the BIOS by the manufacturer.

SMBIOSVersion

BIOS version as reported by SMBIOS.

SMBIOSMajorVersion

Major SMBIOS version number.

SMBIOSMinorVersion

Minor SMBIOS version number.

SMBIOSPresent

Indicates whether the SMBIOS is available on this computer.

Version

Version of the BIOS.

Some, but not all, of this information is also available through the System Information snap-in, as shown in Figure 8.2.

Figure 8.2 Win32_BIOS Properties and System Information

sas_cpm_02c

Scripting Steps

Listing 8.2 contains a script that retrieves BIOS 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_BIOS class.

    This query returns a collection consisting of a single object representing the BIOS installed on the computer.

  4. For each BIOS in the collection, echo the retrieved values.

    Because the BIOS characteristics are contained within an array, a For Each loop must be used to loop through each element in the array.

Listing 8.2 Retrieving BIOS Information

  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
 & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colBIOS = objWMIService.ExecQuery _
 ("SELECT * FROM Win32_BIOS")
For Each objBIOS in colBIOS
 Wscript.Echo "Build Number: " & objBIOS.BuildNumber
 Wscript.Echo "Current Language: " & objBIOS.CurrentLanguage
 Wscript.Echo "Installable Languages: " & objBIOS.InstallableLanguages
 Wscript.Echo "Manufacturer: " & objBIOS.Manufacturer
 Wscript.Echo "Name: " & objBIOS.Name
 Wscript.Echo "Primary BIOS: " & objBIOS.PrimaryBIOS
 Wscript.Echo "Release Date: " & objBIOS.ReleaseDate
 Wscript.Echo "Serial Number: " & objBIOS.SerialNumber
 Wscript.Echo "SMBIOS Version: " & objBIOS.SMBIOSBIOSVersion
 Wscript.Echo "SMBIOS Major Version: " & objBIOS.SMBIOSMajorVersion
 Wscript.Echo "SMBIOS Minor Version: " & objBIOS.SMBIOSMinorVersion
 Wscript.Echo "SMBIOS Present: " & objBIOS.SMBIOSPresent
 Wscript.Echo "Status: " & objBIOS.Status
 Wscript.Echo "Version: " & objBIOS.Version
 For Each intCharacteristic in objBIOS.BiosCharacteristics
 Wscript.Echo "BIOS Characteristics: " & intCharacteristic
 Next
Next