Checking for tablets in MDT – Part 2

@david_obrien sent me a tweet today about my tablet detection algorithm.

Turns out that according to my detection algorithm, Dell thinks the XPS is a Laptop, not a Tablet!!!

a5hg-800

Why is that?

As far as I can tell, Win32_ComputerSystem->PCSystemTypeEx is most likely getting it’s values from POWER_PLATFORM_ROLE enumeration type. This value comes from the Firmware (BIOS), and is filled out by the OEM. However, it’s not really about touch, this field is about power profiles, how the OEM feels this machine will be used. Is the machine a tablet, or a laptop? For the purposes of power management, Dell felt the XPS was more like a Laptop.

So, that still leaves us with the question as to, how do we detect if a machine is a tablet? Perhaps a different way to ask that is to see if the machine supports “Touch”.

That will require a slightly different detection method, and a call to a Win32 API.

Here is an example Powershell script that should detect if a machine has Multi-point-Touch:

Add-Type @"
using System.Runtime.InteropServices;
namespace WinAPI
{	
    public class User32 { 
    [DllImport("user32.dll")] public static extern int GetSystemMetrics(int nIndex); }
}
"@

if ( $Result = [WinAPI.User32]::GetSystemMetrics(86) -band 0x41 -eq 0x41 ) 
{
    "Tablet with Multi-Input and Integrated-Touch"
}
else
{
    "Not Tablet"
}

0x41 is a combination of
NID_INTEGRATED_TOUCH 0x01 The device has an integrated touch digitizer.
and
NID_MULTI_INPUT 0x40 The device supports multiple sources of digitizer input.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s