Devices with third-party antivirus / EDR installed
Uses the Defender Vulnerability Management software inventory to find devices that still have a non-Microsoft antivirus or EDR product installed, with logged-on user and device group. Handy for AV migrations to Defender and for finding leftovers after uninstalls.
// === Parameters ===
// Vendor/product keywords. The ( ^|[^a-z] ) boundaries stop short names like "eset" or "avg" matching inside other words (e.g. "preset").
let AVPattern = @"(?i)(^|[^a-z])(bitdefender|symantec|mcafee|trellix|sophos|eset|kaspersky|trend_?micro|crowdstrike|sentinel_?one|avast|avg|norton|webroot|malwarebytes|panda|f-?secure|avira|g_?data|cylance|carbon_?black)([^a-z]|$)";
let DevicePrefix = ""; // optional, e.g. "ws-" – leave empty for all devices
DeviceTvmSoftwareInventory
| where SoftwareName matches regex AVPattern or SoftwareVendor matches regex AVPattern
| where isempty(DevicePrefix) or DeviceName startswith DevicePrefix
| summarize AVProducts = make_set(SoftwareName) by DeviceId, DeviceName, OSPlatform
| join kind=leftouter (
DeviceInfo
| where Timestamp > ago(30d)
| where isnotempty(MachineGroup)
| summarize arg_max(Timestamp, MachineGroup, LoggedOnUsers) by DeviceId
| extend LoggedOnUser = tostring(parse_json(LoggedOnUsers)[0].UserName)
| project DeviceId, LoggedOnUser, MachineGroup
) on DeviceId
| project DeviceName, OSPlatform, LoggedOnUser, MachineGroup, AVProducts
| order by DeviceName asc
