Latest Antivirus Scan Status
Query
DeviceEvents
| where ActionType == "AntivirusScanCompleted"
| summarize arg_max(Timestamp, *) by DeviceId
| extend ScanType = tostring(parse_json(AdditionalFields).ScanTypeIndex),
DaysAgo = datetime_diff('day', now(), Timestamp)
| project DeviceName, ActionType, ScanType, DaysAgo
// Filter only devices that have not performed a antivirus scan in the last day
| where DaysAgo > 0
| sort by DaysAgoAbout this query
Latest Antivirus Scan Status
Query Information
Description
This query lists the latest completed antivirus scan for each device. The query filters all devices that have performed a successful scan today.
Risk
The Defender sensor is not working corretly and might not be able to idenfity suspicious behaviour.
References
Defender XDR
Sentinel
DeviceEvents
| where ActionType == "AntivirusScanCompleted"
| summarize arg_max(TimeGenerated, *) by DeviceId
| extend ScanType = tostring(parse_json(AdditionalFields).ScanTypeIndex),
DaysAgo = datetime_diff('day', now(), Timestamp)
| project DeviceName, ActionType, ScanType, DaysAgo
// Filter only devices that have not performed a antivirus scan in the last day
| where DaysAgo > 0
| sort by DaysAgo
Explanation
This query is designed to identify devices that have not completed an antivirus scan today. It works by looking at the latest antivirus scan event for each device and checking when it occurred. Here's a simple breakdown of what the query does:
-
Data Source: It looks at events related to antivirus scans from a dataset called
DeviceEvents. -
Filter for Completed Scans: It specifically filters for events where an antivirus scan has been completed, indicated by the
ActionTypebeing "AntivirusScanCompleted". -
Find Latest Scan per Device: For each device, it finds the most recent scan event using the
summarize arg_maxfunction, which selects the event with the latest timestamp. -
Extract Additional Information: It extracts the type of scan performed and calculates how many days ago the scan happened.
-
Project Relevant Information: It selects only the necessary information to display: the device name, action type, scan type, and days since the last scan.
-
Filter for Devices Needing Attention: It filters out devices that have performed a scan today, focusing only on those that haven't scanned in the last day.
-
Sort Results: Finally, it sorts the devices by how many days ago their last scan was completed, showing those with the oldest scans first.
This query helps identify devices that might be at risk because they haven't been scanned recently, which could indicate that the Defender sensor isn't working correctly.
Details

Bert-Jan Pals
Released: October 20, 2024
Tables
Keywords
Operators