Source:
DeviceImageLoadEvents | where InitiatingProcessParentFileName =~ "rundll32.exe" and InitiatingProcessCommandLine has_any ("iwr","Invoke-webrequest")
DeviceProcessEvents | where ProcessCommandLine matches regex @"[^\w]iex[^\w]|invoke-expression"
DeviceProcessEvents | where ProcessCommandLine matches regex @"[^\w]iwr[^\w]|invoke-webrequest"
let excludedParentProcesses = datatable (process:string)["SenseIR.exe","SenseCM.exe"]; DeviceImageLoadEvents | where FileName contains "system.management.automation.dll" and InitiatingProcessParentFileName !in~ (excludedParentProcesses) | project InitiatingProcessParentFileName, InitiatingProcessFileName, InitiatingProcessCommandLine