WMI Filtering Based on Computer Type (Desktop / Laptop)


There have been many discussions on this topic, so what’s one more eh?

I use WMI filters for a lot of situations.  Some include Screensavers, Backgrounds and Power Plans.
Simplicity and future-proofing is what I’m all about, and thinking the currently accepted way to find out if a PC was a desktop or a laptop worked pretty well.  Until I met up with an All-in-One desktop.

I noticed it kept turning off the screen or going to sleep when none of my Power Plans had those options enabled.  Odd I thought, time to figure out what’s going on.

Looking at the output of GPRESULT /R (logged in as an administrator of course), I noticed the Power Plan wasn’t being applied.  It was being denied by the WMI filter.

My first thoughts were… “Oh man, every computer might be affected!” (I may have at the time used other words to describe something you’d only see on fetish websites.)

Well thankfully that wasn’t the case, however all of the All-in-Ones we “inherited” were being affected, so time to fix this little issue ASAP.


Original Desktop WMI Filter

Select * from Win32_PhysicalMemory WHERE (FormFactor != 12)


Fixed Desktop WMI Filter

Select PCSystemType from Win32_ComputerSystem WHERE (PCSystemType=1)



Long story below, so if you’re in a hurry, just use the WMI code in the “Fixed Desktop WMI Filter” section above.


Step 1

Identify the issue with the WMI filter, is the filter working as expected?

Definitely, confirmed it was working on a laptop and desktop that were not All-in-Ones.


Step 2

Using the Microsoft WMI Code Creator, I was able to test the WMI filter and see the return values.

What I was looking for was a returned value that was NOT12”. A return of “12” is what you would expect to see for a laptop, not a desktop. In this case, it returned “12”.  Checking further it looks like the All-in-One has some parts that are more at home in a laptop than a desktop.  Shouldn’t have been surprised, based on the form factor, but hey, it’s good to learn something new every day right?


Step 3

Fixing the WMI code was easier than I had thought.  I was able to find a common value, returned by Windows 7 and up, that gave me the “Desktop” or “Laptop” differentiation I needed.

Using “Win32_ComputerSystem” with “PCSystemType” returns “1” if it’s a Desktop, and “2” if it’s a Laptop.


Here are the return codes for PCSystemType, for your reference.

0 – Unspecified
1 – Desktop
2 – Mobile
3 – Workstation
4 – Enterprise Server
5 – SOHO Server
6 – Appliance PC
7 – Performance Server
8 – Maximum