As you are probably already aware, Microsoft is soon going to be releasing the next version ofÂ Windows called… drum roll… Windows 10. Some of you might have already download the production by downloading the technical preview of Windows 10 as part of the Insider Preview. However, what you might not know is that the version number of Windows 10 is also taking a big leap forward from 6.3 to 10.0 (as you can see below).
Windows 8.1 Version Number
Windows 10 Version Number (Technical Preview 2)
Whenever Windows changes version number there is always applicationsÂ compatibility issues. These have largely been mitigated for Windows 10 applications HOWEVER… WMI filter queries are affected by this change.
The example below might be familiar as it is a common way to apply a GPO to all Versions of WIndows after 7. It would also automatically work for Windows 8 and Windows 8.1 but it will fail for Windows 10.
select * from Win32_OperatingSystem where Version >= “6.1”
The problem stems from the comparison that WMI does as it treats the version as a string and not a number. This means that Version “10” is actually lower than “6.0” as 1 is lower that 6.
As you can see below in my example the same WMI filter as above is evaluating as False on my Windows 10 computer (called Win10).
So… To have a WMI filter that matches Windows 7 or later (including Windows 10) then you need to use the following WMI filter:
select * from Win32_OperatingSystem where Version like “10.%” or Version >=”6.1″
This will evaluate true for Windows 10 AND any version of Windows greater that Windows 7 (6.1) as the report below shows.
In this example I have added used the like operator with the % wildcard so it will match any preview build of Windows 10. This will not work if Microsoft release a version of the OS with 11 version number, but as Microsoft have now said that Windows is going to be a service its a safe bet that this will work for a long while to come.
Of course the final version of Windows 10 has not been released yet so this might still change. However if you are testing Windows 10 in your environment now and you are wondering why the WMI filters GPO’s are applying this is your you can get going today.
Note: The same is also true for Windows Server 2016 as it has the same OS version number.
Thanks to Michale Niehaus for his help with this article.
15 thoughts on “How to apply WMI Filter to Windows 10 or Windows Server 2016”
why not use WMI Windows Caption?
Windows 10 or window server is that great!!
Very useful explanation!
It happend in our system!!
A syntax error occured trying to evaluate a query string.
and for me.
Fr4nk: WordPress has changed the quotes. Delete them and retype and you’ll be fine.
So what happens when Windows 11+ get released? This filter will need to be updated every release?
There will not be another windows revision after 10.
Syntax error is caused by Copy/Paste – delete the ” and retype them.
For anyone wondering about the Syntax error, this website has “bad quotes”. If you were like me and copy and pasted the queries from this website, just replace the quotes with new ones.
Replace the quotes ” ” manually… the ones on this webpage are not going to work, so if you copy and paste you will have problems.
I think it’s better to combine the caption-names with wildcards and operators.
For Windows 10 in general:
Select * from Win32_OperatingSystem WHERE Caption LIKE ‘Microsoft Windows 10%’
Example for english Windows 7, Server 2008r2 and 10 (but not Windows 8.x or 2008):
Select * from Win32_OperatingSystem WHERE (Caption LIKE ‘Microsoft Windows 7%’ OR Caption LIKE ‘Microsoft Windows Server 2008 R2% ‘ OR Caption LIKE ‘Microsoft Windows 10%’) AND OSLanguage = 1033
Add the following as well
ProductType 1 = Desktop OS
ProductType 2 = Server OS â€“ Domain Controller
ProductType 3 = Server OS â€“ Not a Domain Controller
Thanks for sharing this information regarding WMI Filtering. Now that Windows 10 is released for a long time you can update your post. This post is for technical preview.
But again, it was good.