Microsoft® Windows® 2000 Scripting Guide
« Previous | Next »
The chassis is the physical container that houses the components of a computer. Chassis types include the tower configuration, desktop computer, notebook computer, and handheld computer.
At first glance, it might seem that the chassis type is interesting information but of minimal use to system administrators. In truth, however, knowing the physical design of the chassis provides valuable information for system administrators. After all, the physical design is a key factor in determining the type of hardware you can install on the computer; for example, disk drives that can be installed on a desktop computer are unlikely to fit in a subnotebook computer.
Knowing the chassis type of a computer can also be important for:
Traditionally, the only way to identify the chassis type has been by visual inspection. However, the Win32_SystemEnclosure class can be used to determine the chassis type of a computer. Chassis types are stored as an array consisting of one or more of the values shown in Table 8.6.
Table 8.6 Computer Chassis Values
Value | Description |
---|---|
1 | Other |
2 | Unknown |
3 | Desktop |
4 | Low Profile Desktop |
5 | Pizza Box |
6 | Mini Tower |
7 | Tower |
8 | Portable |
9 | Laptop |
10 | Notebook |
11 | Hand Held |
12 | Docking Station |
13 | All in One |
14 | Sub Notebook |
15 | Space-Saving |
16 | Lunch Box |
17 | Main System Chassis |
18 | Expansion Chassis |
19 | Sub Chassis |
20 | Bus Expansion Chassis |
21 | Peripheral Chassis |
22 | Storage Chassis |
23 | Rack Mount Chassis |
24 | Sealed-Case PC |
Listing 8.5 contains a script that identifies computer chassis type. To carry out this task, the script must perform the following steps:
This query returns a collection consisting of the physical properties of the computer and its housing.
To do this, you must set up a For-Next loop to echo the values for the chassis type. The For-Next loop is required because the chassis type is stored as an array.
Listing 8.5 Identifying Computer Chassis Type
|
|
When the script in Listing 8.5 runs, the chassis type is reported as an integer. For example, if the computer has a mini-tower configuration, the value 6 is echoed to the screen. In a production script, a Select Case statement should be used to echo back string values as shown in the following code sample:
Case 6 Wscript.Echo
"This computer is configured as a mini-tower.
"
Send us your feedback | « Previous | Next » |