I want to get events of type error or critical with logfile = application from last week. This query works for first 2 conditions but I don't know how to get only records from last week. I tried "And TimeGenerated > GETDATE()-7" but I got Invalid Query.
Select * from Win32_NTLogEvent where Logfile = 'Application' AND (type ='Error' OR type ='Critical')