WMI Group Policy filters that compare Win32_OperatingSystem BuildNumber don't work as expected on Windows 10

Applies to: Windows 10, version 1809Windows 10, version 1803Windows 10, version 1703 More

Symptoms


Consider the following scenario:
 
  • You want Group Policy to apply to Windows 8.1 and later versions of Windows. 
  • You want to use Win32_OperatingSystem BuildNumber to do this.
  • You create the following Windows Management Instrumentation (WMI) filter, based on known build numbers of Windows versions: 
     
    “Select BuildNumber from Win32_OperatingSystem WHERE BuildNumber >= 9200 “
     
    Build number Windows version
    9200  Windows 8
    9600 Windows 8.1
    10240   Windows 10
    10586  Windows 10, version 1511
    14393 Windows 10, version 1607
    15063 Windows 10, version 1703
    16299 Windows 10, version 1709
    17134 Windows 10, version 1803
    17763 Windows 10, version 1809
In this scenario, although you would expect the WMI filter to cause the Group Policy setting to apply to build number 9200 and later builds, Windows 10 builds are excluded.
 

Cause


This issue occurs because the data type for BuildNumber is String and not Integer. Therefore, 10*** < 9600.

Resolution


To fix this issue, use a filter that resembles the following example.

Note There are several ways to force the string compare to return the result that you want. You can use any method that you prefer. The example is fully functional.
 
Select BuildNumber from Win32_OperatingSystem WHERE BuildNumber >= 10000 AND BuildNumber LIKE "%[123456789][0123456789][0123456789][0123456789][0123456789]%" OR BuildNumber >= 9200 AND BuildNumber LIKE "%[123456789][0123456789][0123456789][0123456789]%"