Intune filter rules based on OS versions — Handy reference
Here is a handy reference if you are trying to create Intune filters for the purpose of targeting only certain operating system versions (or excluding them) from App or policy deployments.
Steps:
- Remove my comments or use the github link to copy without comments.
- Copy and Paste the relevant sections into the Advanced syntax editor
Windows 10 and later
Example — All Windows 10 and 11 major versions (copy from github)
(device.osVersion -startsWith "10.0.22") // Windows 11 Original release
or (device.osVersion -startsWith "10.0.19043") // Windows 10 21H1
or (device.osVersion -startsWith "10.0.19042") // Windows 10 20H2
or (device.osVersion -startsWith "10.0.19041") // Windows 10 2004
or (device.osVersion -startsWith "10.0.18363") // Windows 10 1909
or (device.osVersion -startsWith "10.0.18362") // Windows 10 1903
or (device.osVersion -startsWith "10.0.17763") // Windows 10 1809
or (device.osVersion -startsWith "10.0.17134") // Windows 10 1803
or (device.osVersion -startsWith "10.0.16299") // Windows 10 1709
or (device.osVersion -startsWith "10.0.15063") // Windows 10 1703
or (device.osVersion -startsWith "10.0.14393") // Windows 10 1607
or (device.osVersion -startsWith "10.0.10586") // Windows 10 1511
or (device.osVersion -startsWith "10.0.10240") // Windows 10 1507 (RTM)
Android Enterprise
There are some differences in how Android devices report their model information to Intune. For example, Work Profile (ie: BYOD) devices report version numbers including a decimal point (eg: “11.0") but COSU/COBO/COPE, from version 9 and up only show the major version (eg: 11).
For this reason, If you are targeting a policy for both management types, Id recommend using the -Startswith or -Contains to make sure you are capturing both.
Here are a couple of examples
Example — Target all Android Enterprise by major Android version release (copy from github)
Device.osVersion -startswith ("12")
or Device.osVersion -startswith ("11")
or Device.osVersion -startswith ("10")
or Device.osVersion -startswith ("9") //Pie
or Device.osVersion -startswith ("8") //Oreo
or Device.osVersion -startswith ("7") //Nougat
or Device.osVersion -startswith ("6") //Marshmallow
or Device.osVersion -startswith ("5") //Lollipop
Example — Target all Android Enterprise (COSO, COPE, COSU devices) by using explicit version numbers (copy from github)
Device.osVersion -eq ("12")
or Device.osVersion -eq ("11")
or Device.osVersion -eq ("10")
or Device.osVersion -eq ("9")
or Device.osVersion -eq ("8.1.0")
or Device.osVersion -eq ("8.0.0")
or Device.osVersion -eq ("7.1.2")
or Device.osVersion -eq ("7.1.1")
or Device.osVersion -eq ("7.0")
or Device.osVersion -eq ("6.0.1")
or Device.osVersion -eq ("6.0")
or Device.osVersion -eq ("5.0.2")
or Device.osVersion -eq ("5.1.1")
Example — Target all Android Enterprise (work profile devices) by explicit version (copy from github)
(Tip: Notice work profile devices have a period period (.0) for major versions)
Device.osVersion -eq ("12.0")
or Device.osVersion -eq ("11.0")
or Device.osVersion -eq ("10.0")
or Device.osVersion -eq ("9.0")
or Device.osVersion -eq ("8.1.0")
or Device.osVersion -eq ("8.0.0")
or Device.osVersion -eq ("7.1.2")
or Device.osVersion -eq ("7.1.1")
or Device.osVersion -eq ("7.0")
or Device.osVersion -eq ("6.0.1")
or Device.osVersion -eq ("6.0")
or Device.osVersion -eq ("5.1.1")
or Device.osVersion -eq ("5.1")
or Device.osVersion -eq ("5.0.2")
or Device.osVersion -eq ("5.0.1")
or Device.osVersion -eq ("5.0")
Android Device Administrator
Android DA devices typically show in the Intune console with the full version number string including decimal separating major and minor version. Depending on your requirements you can filter in/out major versions or be explicit about minor versions.
Example — Target all Android DA by major Android version release (copy from github)
Device.osVersion -startswith ("12")
or Device.osVersion -startswith ("11")
or Device.osVersion -startswith ("10")
or Device.osVersion -startswith ("9") //Pie
or Device.osVersion -startswith ("8") //Oreo
or Device.osVersion -startswith ("7") //Nougat
or Device.osVersion -startswith ("6") //Marshmallow
or Device.osVersion -startswith ("5") //Lollipop
or Device.osVersion -startswith ("4") //Ice Cream Sandwich
Example — Target all Android DA by explicit version (copy from github)
Device.osVersion -eq ("12.0")
or Device.osVersion -eq ("11.0")
or Device.osVersion -eq ("10.0")
or Device.osVersion -eq ("9.1")
or Device.osVersion -eq ("9.0")
or Device.osVersion -eq ("8.0.0")
or Device.osVersion -eq ("8.1.0")
or Device.osVersion -eq ("8.1")
or Device.osVersion -eq ("8.0")
or Device.osVersion -eq ("7.1.2")
or Device.osVersion -eq ("7.1")
or Device.osVersion -eq ("7.1.1")
or Device.osVersion -eq ("7.0.0")
or Device.osVersion -eq ("7.0")
or Device.osVersion -eq ("6.1")
or Device.osVersion -eq ("6.0.1")
or Device.osVersion -eq ("6.0")
or Device.osVersion -eq ("5.1.1")
or Device.osVersion -eq ("5.1")
or Device.osVersion -eq ("5.0.2")
or Device.osVersion -eq ("5.0.1")
or Device.osVersion -eq ("5.0")
or Device.osVersion -eq ("4.0")
or Device.osVersion -eq ("4.4.4")
or Device.osVersion -eq ("4.4.2")
or Device.osVersion -eq ("4.2.2")
iOS / iPadOS
iPhones, iPads and iPods seem to be pretty consistent in their use of version numbers. Here is a sample using the -eq operator. I think it makes a lot of sense to use -Startswith when working with iOS/iPad OS versions.
Example — Target all iOS/iPadOS by major version (copy from github)
Device.osVersion -startswith ("15")
or device.osVersion -startswith ("14")
or Device.osVersion -startswith ("13")
or Device.osVersion -startswith ("12")
or Device.osVersion -startswith ("11")
or Device.osVersion -startswith ("10")
or Device.osVersion -startswith ("9")
Example — Target all iOS/iPadOS by explicit version (copy from github)
device.osVersion -eq ("15.1")
or device.osVersion -eq ("15.0.2")
or device.osVersion -eq ("15.0.1")
or device.osVersion -eq ("15.0")
or device.osVersion -eq ("15.0")
or device.osVersion -eq ("14.8")
or device.osVersion -eq ("14.8")
or device.osVersion -eq ("14.7.1")
or device.osVersion -eq ("14.7.1")
or device.osVersion -eq ("14.7")
or device.osVersion -eq ("14.6")
or device.osVersion -eq ("14.6")
or device.osVersion -eq ("14.5.1")
or device.osVersion -eq ("14.5")
or device.osVersion -eq ("14.4.2")
or device.osVersion -eq ("14.4.2")
or device.osVersion -eq ("14.4.1")
or device.osVersion -eq ("14.4")
or device.osVersion -eq ("14.4")
or device.osVersion -eq ("14.3")
or device.osVersion -eq ("14.2.1")
or device.osVersion -eq ("14.2")
or device.osVersion -eq ("14.1")
or device.osVersion -eq ("14.0.1")
or device.osVersion -eq ("14.0")
or device.osVersion -eq ("13.7")
or device.osVersion -eq ("13.6.1")
or device.osVersion -eq ("13.6")
or device.osVersion -eq ("13.5.5")
or device.osVersion -eq ("13.5.1")
or device.osVersion -eq ("13.5.1")
or device.osVersion -eq ("13.5")
or device.osVersion -eq ("13.4.5")
or device.osVersion -eq ("13.4.1")
or device.osVersion -eq ("13.4")
or device.osVersion -eq ("13.3.1")
or device.osVersion -eq ("13.3")
or device.osVersion -eq ("13.2.3")
or device.osVersion -eq ("13.2.2")
or device.osVersion -eq ("13.2")
or device.osVersion -eq ("13.1.3")
or device.osVersion -eq ("13.1.2")
or device.osVersion -eq ("13.1.1")
or device.osVersion -eq ("13.1")
or device.osVersion -eq ("13.0")
or device.osVersion -eq ("12.5.5")
or device.osVersion -eq ("12.5.4")
or device.osVersion -eq ("12.5.3")
or device.osVersion -eq ("12.5.2")
or device.osVersion -eq ("12.5.1")
or device.osVersion -eq ("12.5")
or device.osVersion -eq ("12.4.9")
or device.osVersion -eq ("12.4.8")
or device.osVersion -eq ("12.4.7")
or device.osVersion -eq ("12.4.6")
or device.osVersion -eq ("12.4.5")
or device.osVersion -eq ("12.4.4")
or device.osVersion -eq ("12.4.3")
or device.osVersion -eq ("12.4.2")
or device.osVersion -eq ("12.4.1")
or device.osVersion -eq ("12.4")
or device.osVersion -eq ("12.3.2")
or device.osVersion -eq ("12.3.1")
or device.osVersion -eq ("12.3")
or device.osVersion -eq ("12.2")
or device.osVersion -eq ("12.1.4")
or device.osVersion -eq ("12.1.3")
or device.osVersion -eq ("12.1.2")
or device.osVersion -eq ("12.1.1")
or device.osVersion -eq ("12.1")
or device.osVersion -eq ("12.0.1")
or device.osVersion -eq ("12.0")
or device.osVersion -eq ("11.4.1")
or device.osVersion -eq ("11.4")
or device.osVersion -eq ("11.3.1")
or device.osVersion -eq ("11.3")
or device.osVersion -eq ("11.2.6")
or device.osVersion -eq ("11.2.5")
or device.osVersion -eq ("11.2.2")
or device.osVersion -eq ("11.2.1")
or device.osVersion -eq ("11.2")
or device.osVersion -eq ("11.1.2")
or device.osVersion -eq ("11.1.1")
or device.osVersion -eq ("11.1")
or device.osVersion -eq ("11.0.3")
or device.osVersion -eq ("11.0.2")
or device.osVersion -eq ("11.0.1")
or device.osVersion -eq ("11.0")
or device.osVersion -eq ("10.3.4")
or device.osVersion -eq ("10.3.3")
or device.osVersion -eq ("10.3.2")
or device.osVersion -eq ("10.3.1")
or device.osVersion -eq ("10.3")
or device.osVersion -eq ("10.3")
or device.osVersion -eq ("10.2.1")
or device.osVersion -eq ("10.2")
or device.osVersion -eq ("10.1.1")
or device.osVersion -eq ("10.0.2")
or device.osVersion -eq ("10.0.1")
or device.osVersion -eq ("9.3.6")
or device.osVersion -eq ("9.3.5")
or device.osVersion -eq ("9.3.4")
or device.osVersion -eq ("9.3.3")
or device.osVersion -eq ("9.3.2")
or device.osVersion -eq ("9.3.1")
or device.osVersion -eq ("9.2.1")
or device.osVersion -eq ("9.2")
or device.osVersion -eq ("9.1")
or device.osVersion -eq ("8.4.1")
or device.osVersion -eq ("8.4")
or device.osVersion -eq ("8.3")
If you are new to Filters in Microsoft Endpoint Manager — I suggest reading the Microsoft docs : https://docs.microsoft.com/en-us/mem/intune/fundamentals/filters