none
GPO WMI Filter Syntax and Query

    Question

  • I have a GPO I am building, in the GPO will be 3 Group Policy Preferences;

    The first is a registry preference of the OEMBackground value to 1, which permits the Windows 7 clients to use a custom login background.

    The second will add the folder C:\Windows\System32\Oobe\Info\Backgrounds.

    The third will add the background image file from a share on a server \-\DC1\Shared\Background1024x768\BackgroundDefault.jpg to the directory listed above.

    The last part I am struggling with as I am unfamiliar with the syntax and use of WMI Filters but I would like to use one to make this only apply to machines with an appropriately matching resolution, what I have so far is:

    Namespace: root\CIMV2

    Query: SELECT * FROM Win32_VideoSettings WHERE HorizontalResolution = 1024 AND VerticalResolution = 768

    I know the GPO in general works without any kind of filter on it but just need some help for the WMI filter. I am trying to avoid using a script. and If this the filter could instead be done through Item level targeting with a WMI query instead would be nice

    The Functional level I am working with is Windows Server 2008


    • Edited by DJSeras Thursday, June 04, 2015 12:36 AM Shortened
    Thursday, June 04, 2015 12:32 AM

All replies

  • > Query: SELECT * FROM Win32_VideoSettings WHERE HorizontalResolution =
    > 1024 AND VerticalResolution = 768
     
    Sometimes, it's hard to find the class and properties that do the job :)
     
    Anyway - Win32_Videosettings is only a relation class between video
    controllers and associated available settings, so you cannot use it. You
    cannot use Cim_Videocontrollerresolution either, because this class
    lists ALL resolutions the graphic cards support.
     
    We use two filters only, to identify 4:3 and widescreen display.
    Sufficient for us. And we eventually decided to go with
    Win32_VideoController.VideoModeDescription.
     
    4:3 filter:
     
    SELECT VideoModeDescription FROM Win32_VideoController WHERE
    VideoModeDescription LIKE "640 x 480 %" OR VideoModeDescription LIKE
    "800 x 600 %" OR VideoModeDescription LIKE "1024 x 768 %" OR
    VideoModeDescription LIKE "1152 x 864 %" OR VideoModeDescription LIKE
    "1280 x 960 %" OR VideoModeDescription LIKE "1280 x 1024 %" OR
    VideoModeDescription LIKE "1400 x 1050 %" OR VideoModeDescription LIKE
    "1600 x 1200 %"
     
    (No Surface Pro 3 in our environment, so we didn't add its Hi-Res)
     
    Widescreen filter:
     
    SELECT VideoModeDescription FROM Win32_VideoController WHERE
    VideoModeDescription LIKE "848 x 480 %" OR VideoModeDescription LIKE
    "1152 x 768 %" OR VideoModeDescription LIKE "1280 x 600 %" OR
    VideoModeDescription LIKE "1280 x 720 %" OR VideoModeDescription LIKE
    "1280 x 768 %" OR VideoModeDescription LIKE "1280 x 800 %" OR
    VideoModeDescription LIKE "1366 x 768 %" OR VideoModeDescription LIKE
    "1440 x 900 %" OR VideoModeDescription LIKE "1600 x 900 %" OR
    VideoModeDescription LIKE "1680 x 1050 %" OR VideoModeDescription LIKE
    "1920 x 1080 %" OR VideoModeDescription LIKE "1920 x 1200 %" OR
    VideoModeDescription LIKE "2560 x 1600 %"
     

    Greetings/Grüße, Martin

    Mal ein gutes Buch über GPOs lesen?
    Good or bad GPOs? - my blog…
    And if IT bothers me - coke bottle design refreshment (-:
    Friday, June 05, 2015 8:33 AM
  • This didn't seem to work either, is there some sort of option I need to turn on or off?

    also noted: every time I click OK after tryping the query I receive a warning of:

    "Either the namespace is entered is not a valid namespace on the local computer or you do not have access to this namespace on this computer. It is possible this is a valid namespace on the remote compute(s). If you wish to use this namespace, press OK. Press cancel to choose another namespace

    Friday, June 05, 2015 6:08 PM
  • > This didn't seem to work either, is there some sort of option I need to
    > turn on or off?
     
    No. Please provide more information: What's currently implemented in
    your environment (exactly! :-)) and what doesn't work?
     
    > "Either the namespace is entered is not a valid namespace on the local
    > computer or you do not have access to this namespace on this computer.
     
    Yes. Bug in 2012R2.
     

    Greetings/Grüße, Martin

    Mal ein gutes Buch über GPOs lesen?
    Good or bad GPOs? - my blog…
    And if IT bothers me - coke bottle design refreshment (-:
    Monday, June 08, 2015 10:24 AM
  • So the domain that will have the group policy in the end will be a Windows Server 2008 Environment, but I'm currently testing on a Virtual machine running Server 2012 and have a VM client running Windows 7

    Everything in the 2012 environment is the same as when you first install the system aside from configurations of being in a domain, being able to communicate in the network, and the Group Policy I am building


    • Edited by DJSeras Monday, June 08, 2015 6:24 PM
    Monday, June 08, 2015 6:24 PM
  • The things listed below are part of a single group policy:

    • Group Policy Preferences Folder directory creation (used to make the directory for the following Preference to add a file to)
    • Group Policy Preferences File replication from one location to another (creates the file to be used as a wallpaper in the appropriate *new* directory
    • Group Policy Preferences Registry key modification to allow for use of a custom background image

    And aside from that group policy's preferences the only other thing that would be used is a WMI filter. I know the group policy works, I just cant figure out the Filter portion. Again the server im testing on is a fresh environment, all defaults. The environment it will go to will of course not be but I need to test first.

    Tuesday, June 09, 2015 1:53 AM
  • > The things listed below are part of a single group policy:
     
    So what is your question now?
     

    Greetings/Grüße, Martin

    Mal ein gutes Buch über GPOs lesen?
    Good or bad GPOs? - my blog…
    And if IT bothers me - coke bottle design refreshment (-:
    Tuesday, June 09, 2015 9:03 AM
  • How to properly WMI filter the policy based on Screen resolution, the things I've tried before don't work and what you listed above doesn't seem to work either
    Tuesday, June 09, 2015 6:07 PM
  • > things I've tried before don't work and what you listed above doesn't
    > seem to work either
     
    Show what you have implemented. Here, my filters DO work :)
     

    Greetings/Grüße, Martin

    Mal ein gutes Buch über GPOs lesen?
    Good or bad GPOs? - my blog…
    And if IT bothers me - coke bottle design refreshment (-:
    Wednesday, June 10, 2015 10:26 AM
  • Hi DJSeras,

    Would you please share some update with us regarding this case?

    Looking farward to your feedback.

    Best Regards,

    Elaine


    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Wednesday, June 17, 2015 6:31 AM
    Moderator