SELECT * FROM events WHERE devicetype=12 AND (((LOWER("Process Path") LIKE '%\reg.exe' OR LOWER("Process Name") LIKE '%\reg.exe') OR Filename='reg.exe') AND (LOWER(Command) LIKE '% add %' AND LOWER(Command) LIKE '%\currentcontrolset\control\terminal server%' AND LOWER(Command) LIKE '%reg_dword%' AND LOWER(Command) LIKE '% /f%')) AND ((LOWER(Command) LIKE '%licensing core%' AND LOWER(Command) LIKE '%enableconcurrentsessions%') OR (LOWER(Command) LIKE '%allowtsconnections%' OR LOWER(Command) LIKE '%fdenytsconnections%' OR LOWER(Command) LIKE '%fenablewinstation%' OR LOWER(Command) LIKE '%fsinglesessionperuser%' OR LOWER(Command) LIKE '%idlewinstationpoolcount%' OR LOWER(Command) LIKE '%maxinstancecount%' OR LOWER(Command) LIKE '%securitylayer%' OR LOWER(Command) LIKE '%tsadvertise%' OR LOWER(Command) LIKE '%tsappcompat%' OR LOWER(Command) LIKE '%tsenabled%' OR LOWER(Command) LIKE '%tsuserenabled%' OR LOWER(Command) LIKE '%winstations\rdp-tcp%')) AND (NOT((LOWER(Command) LIKE '%securitylayer%' AND Command LIKE '%02%')))