Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I tell if a user is using a laptop

I need a way for my .Net Winform app to detect if my app is opened on a Laptop or a Workstation.

I have looked at Environment and SystemInformation but to no avail. Would WMI do the trick?

Thanks for the direction....


As requested I have an application that uses Merge Replication to allow our users to work in Members homes. Some who use the program never go in the field and as such only have towers. This is a WORK only app so our systems are somewhat controlled. As in, no UPS on Desktops and No Laptop CPU either.

I have setup my DAL to be able to switch, based an a setting, between local SQL and the Central SQL Server. I would like to be able to set this automatically based on there system.

If a laptop then they should be pointing local if a tower, centrally.

Does this help? I deliberately left it off before to don't clutter the answers. My apologies for apologies for accomplishing the opposite.

like image 586
Refracted Paladin Avatar asked May 14 '10 19:05

Refracted Paladin


2 Answers

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.

like image 160
Robert Greiner Avatar answered Nov 06 '22 19:11

Robert Greiner


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
like image 36
Keith Nicholas Avatar answered Nov 06 '22 19:11

Keith Nicholas