Query Details

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, OS

Explanation

This query is doing two main things:

  1. 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.

  2. 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 profile picture

Ugur Koc

Released: July 21, 2022

Tables

IntuneDeviceComplianceOrg

Keywords

Count,Company,Devices,Compliant,NotCompliant,IntuneDeviceComplianceOrg,LastContact,ComplianceState,OwnerType,TimeGenerated,DeviceName,OS

Operators

todatetime()ago()where()==summarize()arg_max()byproject()count()

Actions