Finding out which machines are Laptops in a domain
Say you want to provision some settings only on all laptops in your corporate domain. The problemthough is, how do you identify which computers ones are laptops?
WMI Class win32_systemEnclosure has a property - ChassisTypes. ChassisTypes is 9 in a laptop.
Addtion based on reader feedback: ChassisTypes might not be 9 always, on some machines you'll see 8 (portable), 9 (notebook) as well. It is also a good idea to look for batteries as well using win32_battery class.
ChassisTypes
Data type: uint16 array
Access type: Read-only
Array of chassis types. This property is inherited from CIM_Chassis.
Value |
Meaning |
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 |
SubChassis |
20 |
Bus Expansion Chassis |
21 |
Peripheral Chassis |
22 |
Storage Chassis |
23 |
Rack Mount Chassis |
24 |
Sealed-Case PC |
Details on win32_systemenclosure
https://msdn.microsoft.com/en-us/library/aa394474(VS.85).aspx
Kapil Mathur [MSFT]
Comments
Anonymous
December 14, 2009
It seams that testing for 9 is not sufficient. For example my laptop has 8 - Portable.Anonymous
December 14, 2009
Hi As Max mentions here above, using this is not the best idea. The workaround i use is to check for batteries. brgdsAnonymous
December 15, 2009
Thanks for your comments Max and Bruno! checking forBattery does seem like a good idea. I'll add that in a followup post to this.Anonymous
December 15, 2009
As mentioned not the best option, additionally checking for just one isn't always the greatest. I've had the best luck using a combination of Win32_Battery, Win32_PortableBattery, Win32_PCMCIAController and Win32_PhysicalMemory.