Compliance Number And List Of Company Owned Devices With Compliance Status
Query
// Count of Company owned Devices that are Compliant or Not compliant
IntuneDeviceComplianceOrg
| where todatetime(LastContact) > ago(30d)
| where ComplianceState == "Not compliant" // Change to "Compliant" if you want to count only Compliant Devices
| where OwnerType == "Company"
| summarize arg_max(TimeGenerated, *) by DeviceName
| project ComplianceState, DeviceName, LastContact
| summarize count(DeviceName)
// Create a List with all devices:
IntuneDeviceComplianceOrg
| where todatetime(LastContact) > ago(30d)
| where ComplianceState == "Not compliant" // Change to "Compliant" if you want to count only Compliant Devices
| where OwnerType == "Company"
| summarize arg_max(TimeGenerated, *) by DeviceName
| project ComplianceState, DeviceName, LastContact, OSExplanation
This query is doing two main things:
-
It's counting the number of company-owned devices that are either compliant or not compliant, based on their last contact within the past 30 days. The compliance state can be changed to either "Compliant" or "Not compliant" depending on what you want to count.
-
It's creating a list of all these devices, showing their compliance state, device name, last contact, and operating system. Again, the compliance state can be changed to either "Compliant" or "Not compliant" depending on what you want to list.
Details

Ugur Koc
Released: July 21, 2022
Tables
IntuneDeviceComplianceOrg
Keywords
CountCompanyDevicesCompliantNot CompliantIntuneDeviceComplianceOrgLastContactComplianceStateOwnerTypeTimeGeneratedDeviceNameOS
Operators
todatetime()ago()where()==summarize()arg_max()byproject()count()