Query Details

Device Translate OS Build To Version

Query

IntuneDevices
| where OS contains "Windows"
| summarize arg_max(TimeGenerated, *) by DeviceName
| where todatetime(LastContact) > ago(30d) 
| extend WindowsVersion = case(OSVersion contains '19041', "20H1", 
                                OSVersion contains '19042', "20H2",    
                                OSVersion contains '19043', "21H1", 
                                OSVersion contains '19044', "21H2",
                                OSVersion contains '18363', "1909",
                                OSVersion contains '22000', "Win11 21H2",
                                "Unknown")
| summarize Count=count() by OSVersion, WindowsVersion
| sort by Count desc

Explanation

This query is looking at a list of devices managed by Microsoft Intune. It first filters out any devices that are not running a Windows operating system. Then, it selects the most recent record for each device based on the time the data was generated.

Next, it filters out any devices that have not been in contact in the last 30 days. It then adds a new column, 'WindowsVersion', which categorizes the devices based on their OS version number.

Afterwards, it counts the number of devices running each version of Windows and sorts the results in descending order based on the count. So, the output will be a list of Windows versions, along with the number of devices running each version, with the most common version at the top of the list.

Details

Ugur Koc profile picture

Ugur Koc

Released: July 31, 2022

Tables

IntuneDevices

Keywords

IntuneDevices,OS,Windows,TimeGenerated,DeviceName,LastContact,WindowsVersion,OSVersion,Count

Operators

IntuneDeviceswherecontainssummarizearg_maxbytodatetimeLastContactagoextendcasecountsortdesc.

Actions