Query Details
IntuneDeviceComplianceOrg | where todatetime(LastContact) > ago(30d) | where ComplianceState == "Not compliant" | summarize arg_max(TimeGenerated, *) by DeviceName | project ComplianceState, DeviceName, LastContact
This query is checking the compliance status of devices in an organization using Intune Device Compliance. It filters out devices that have not been in contact for more than 30 days and those that are not compliant. It then returns the most recent record for each device based on the time the data was generated. The final output of the query will show the compliance state, device name, and the last contact time.

Ugur Koc
Released: July 10, 2022
Tables
Keywords
Operators