WMI Filter Help For Group Policy Processing

MISAdmin 386 Reputation points
2021-07-13T18:06:01.567+00:00

Can someone show me the WMI Filter which will apply for Windows 7 or Windows 10 but not any Server OS?

Windows for business Windows Client for IT Pros User experience Other
0 comments No comments
{count} votes

Accepted answer
  1. DonPick 1,266 Reputation points
    2021-07-16T23:26:00.373+00:00

    use parentheses to group your expression
    https://learn.microsoft.com/en-us/windows/win32/wmisdk/where-clause
    e.g.

    SELECT * FROM Win32_LogicalDisk WHERE (Name = "C:" OR Name = "D:")   
        AND  FreeSpace > 2000000  AND   FileSystem = "NTFS"  
    

    e.g.
    select * from Win32_OperatingSystem WHERE (Version like "10.%" or Version >= "6.1") AND ProductType = "1"

    0 comments No comments

8 additional answers

Sort by: Most helpful
  1. Anonymous
    2021-07-14T02:01:27.38+00:00

    Hello @MISAdmin ,

    Thank you so much for posting here.

    WMI filter for Windows 7:
    Select * from Win32_OperatingSystem WHERE Version like "6.1%" and ProductType="1"

    WMI filter for Windows 10:
    select * from Win32_OperatingSystem where Version like "10.%" and ProductType="1"

    For more information, please refer to:
    https://learn.microsoft.com/en-us/windows/security/threat-protection/windows-firewall/create-wmi-filters-for-the-gpo#:~:text=To%20create%20a%20WMI%20filter%20that%20queries%20for,filter.%20...%206%20Click%20Add.%20More%20items...%20

    For any question, please feel free to contact us.

    Best regards,
    Hannah Xiong

    0 comments No comments

  2. MISAdmin 386 Reputation points
    2021-07-14T11:47:36.007+00:00

    Thank you. I have seen that article but I am looking for one filter that will check all three conditions... is W7 or W10 but NOT a server OS.

    0 comments No comments

  3. Anonymous
    2021-07-15T01:54:01.18+00:00

    Hello @MISAdmin ,

    You are welcome. Thank you so much for your kindly reply.

    If we need to filter W7 and W10 in one WMI, please try the below WMI filter.

    Select * from Win32_OperatingSystem WHERE (Version like "6.1%") or (Version like "10.%") and ProductType="1"

    For any question, please feel free to let me know.

    Best regards,
    Hannah Xiong

    0 comments No comments

  4. MISAdmin 386 Reputation points
    2021-07-15T13:37:23.97+00:00

    Hi. That is similar to the one I was using however, Server 2019 boxes also received the policies (unwanted). Here's what I had...

    select * from Win32_OperatingSystem WHERE Version like "10.%" or Version >= "6.1" AND ProductType = "1"

    Even though I had ProductType ="1", Server 2019 still received the policies. Will yours prevent the policies from being applied on Server 2019?

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.