• Home
  • Virtualization
    • Citrix
    • VMware
  • Coding
    • Apache
    • Powershell
    • VBScript
  • Applications
    • Windows
      • DHCP
      • Group Policy
      • MDT
  • Mobile
    • Android
    • iOS
  • Culinary
    • Recipes

the STONYWALL blog

where my mind comes to rest...

Menu
  • Home
  • Virtualization
    • Citrix
    • VMware
  • Coding
    • Apache
    • Powershell
    • VBScript
  • Applications
    • Windows
      • DHCP
      • Group Policy
      • MDT
  • Mobile
    • Android
    • iOS
  • Culinary
    • Recipes
 › Group Policy › WMI Filtering Based on Computer Type (Desktop / Laptop)

WMI Filtering Based on Computer Type (Desktop / Laptop)

Derek Bannard May 1, 2017     Comment Closed    

 

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

Original Desktop WMI Filter
1
Select * from Win32_PhysicalMemory WHERE (FormFactor != 12)

 

Fixed Desktop WMI Filter

Fixed Desktop WMI Filter
1
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 NOT “12”. 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

Group Policy
filtergpowmi

 Previous Post

UCCX: Fix DB Replication by Dropping Syscdr

― April 4, 2017

Next Post 

VMware ESXi 6.5 RDM Initialization

― June 23, 2017

Author: Derek Bannard

Search

Categories

Recent Posts

  • Quick Tips: Updating ESXi Host (Online Method)
  • MDT Task Sequence: Inline Surface Pro Pen Pairing without Image Modifications
  • Local Admin Users on Domain Workstations (GPO/AD Method)
  • PowerShell: SFTP Script to Upload Files to an SFTP Server
  • VMware: Matching Attached vDisk UUID to Guest Windows HDD

Archives

  • April 2018
  • February 2018
  • January 2018
  • July 2017
  • June 2017
  • May 2017
  • April 2017
  • February 2017
  • November 2016

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org