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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With