This script can be adapted to be very useful. It essentially can determine if a computer is a desktop or a laptop, among many other types. We use it during the localization of a cross-platform image on a computer. If the computer is a desktop, specific commands run that we don't want to run on a laptop, and vice versa.
**BEGIN************
#This will extract a number from the WMI database that represents the type of chassis
$WMIQuery = get-wmiobject -class win32_systemenclosure -property chassistypes
ForEach ($obj in $WMIQuery) {
$TypeNum = $obj.chassistypes
}
#This switch block interprets that number into meaningful information.
switch ($TypeNum) {
1 {"Other"; break}
2 {"Unknown" ; break}
3 {"Desktop" ; break}
4 {"Low Profile Desktop"; break}
5 {"Pizza Box"; break}
6 {"Mini Tower"; break}
7 {"Tower"; break}
8 {"Portable"; break}
9 {"Laptop"; break}
10 {"Notebook"}
11 {"Handheld"; break}
12 {"Docking Station"; break}
13 {"All-in-One"; break}
14 {"Sub-Notebook"; break}
15 {"Space Saving"; break}
16 {"Lunch Box"; break}
17 {"Main System Chassis"; break}
18 {"Expansion Chassis"; break}
19 {"Sub-Chassis"; break}
20 {"Bus Expansion Chassis"; break}
21 {"Peripheral Chassis"; break}
22 {"Storage Chassis"; break}
23 {"Rack Mount Chassis"; break}
24 {"Sealed-Case PC"; break}
default {"Unknown"; break}
}
**END************
Thursday, April 12, 2007
Subscribe to:
Comments (Atom)