How can I tell if a user is using a laptop

http://msdn.microsoft.com/en-us/library/Aa394474

then look at

ChassisTypes

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

Get the type of processor using (see this question):

System.Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE")

If you can determine it is a mobile processor, you have your answer.

(It's worth noting that WMI will give you better info, as explained in the question I linked.)


This is a really hard problem to solve because of the edge cases involved. I don'tk now how accurate you need to be for your application, but here is a reliable way to find out if the user is on a sterotypical laptop.

Win32_Battery

You might want to take a look at EstimatedRunTime.

EstimatedRunTime

Data type: uint32
Access type: Read-only

Estimate in minutes of the time to battery charge depletion under the

present load conditions if the utility power is off, or lost and remains off, or a laptop is disconnected from a power source. This property is inherited from CIM_Battery.

You also might want to check:

Win32_PortableBattery

Also, here's an interesting discussion of a similar problem and dealing with UPS.

http://forum.bigfix.com/viewtopic.php?pid=19908

Specifically:

"Microsoft ACPI-Compliant Control Method Battery"

Also, as noted in the comments, you will have to consider users on a laptop plugged into the wall with the battery disconnected.