DeviceProcessEvents | where (InitiatingProcessFolderPath endswith "\\sqlservr.exe" and (FolderPath endswith "\\bash.exe" or FolderPath endswith "\\bitsadmin.exe" or FolderPath endswith "\\cmd.exe" or FolderPath endswith "\\netstat.exe" or FolderPath endswith "\\nltest.exe" or FolderPath endswith "\\ping.exe" or FolderPath endswith "\\powershell.exe" or FolderPath endswith "\\pwsh.exe" or FolderPath endswith "\\regsvr32.exe" or FolderPath endswith "\\rundll32.exe" or FolderPath endswith "\\sh.exe" or FolderPath endswith "\\systeminfo.exe" or FolderPath endswith "\\tasklist.exe" or FolderPath endswith "\\wsl.exe")) and (not((InitiatingProcessFolderPath startswith "C:\\Program Files\\Microsoft SQL Server\\" and InitiatingProcessFolderPath endswith "DATEV_DBENGINE\\MSSQL\\Binn\\sqlservr.exe" and FolderPath =~ "C:\\Windows\\System32\\cmd.exe" and ProcessCommandLine startswith "\"C:\\Windows\\system32\\cmd.exe\" ")))