Query Details
//This query returns a report of all devices where a full antivirus scan was never successful
//Note: The !has operator may show an error but will return results if any exist
DeviceEvents
| where ActionType has_any ("AntivirusScanCompleted", "AntivirusScanCancelled")
| extend AdditionalFields = parse_json(AdditionalFields)
| extend ScanType = AdditionalFields.["ScanTypeIndex"]
| where ScanType == "Full"
| summarize make_set(ActionType) by DeviceId, DeviceName
| where set_ActionType !has ("AntivirusScanCompleted") This query is designed to generate a report listing all devices where a full antivirus scan has never been successfully completed. Here's a breakdown of what the query does:
Data Source: It starts by looking at the DeviceEvents table, which contains records of various events related to devices.
Filter Events: It filters the events to only include those where the action type is either "AntivirusScanCompleted" or "AntivirusScanCancelled". These events indicate whether an antivirus scan was completed or canceled.
Extract Additional Information: It extracts additional details from a field named AdditionalFields by converting it into a JSON format. From this JSON, it specifically pulls out the ScanTypeIndex, which indicates the type of scan performed.
Focus on Full Scans: It further filters the data to only include events where the scan type was "Full", meaning it was a comprehensive antivirus scan.
Summarize by Device: It groups the data by DeviceId and DeviceName, creating a set of action types (make_set(ActionType)) for each device. This set will show whether a full scan was completed or canceled.
Identify Devices with No Successful Full Scans: Finally, it filters the results to only include devices where the set of action types does not contain "AntivirusScanCompleted". This means that for these devices, a full antivirus scan has never been successfully completed.
In summary, the query identifies devices that have attempted full antivirus scans but have never successfully completed one.

User Submission
Released: November 10, 2024
Tables
Keywords
Operators