Device Last Time The Device Was Active
Query
// Show a list of devices and timestamp the last time they successfully connected to Intune.
IntuneDeviceComplianceOrg
| where todatetime(LastContact) > ago(30d)
| extend Date=format_datetime(todatetime(LastContact), "dd.MM.yyyy")
| extend Time=format_datetime(todatetime(LastContact), "hh:mm tt")
| extend ['Last successful connection']=strcat(Date," ",Time)
| project DeviceName, ['Last successful connection']
| project-rename ['Name of the Device'] = DeviceNameExplanation
This query is used to display a list of devices and the last time they successfully connected to Intune within the past 30 days. It formats the date and time of the last successful connection and combines them into a single column. Finally, it renames the column that contains the device names.
Details

Ugur Koc
Released: July 6, 2022
Tables
IntuneDeviceComplianceOrg
Keywords
IntuneDeviceComplianceOrgLastContactDateTimeLast Successful ConnectionDeviceNameName of the Device
Operators
IntuneDeviceComplianceOrgwheretodatetimeagoextendformat_datetimestrcatprojectproject-rename