Hello,
I use the following code to get events from the security log, by computername and event id. I need to take it one step further. I want to pull these events that occurred during the last week. How can I modify the command below to do this? I know it has something to do with TimeGenerated but not sure how to structure it so that only the last week's events are pulled. TIA
I use the following code to get events from the security log, by computername and event id. I need to take it one step further. I want to pull these events that occurred during the last week. How can I modify the command below to do this? I know it has something to do with TimeGenerated but not sure how to structure it so that only the last week's events are pulled. TIA
Code:
Get-WmiObject -Class win32_NTLogEvent -filter "logfile = '$log' and EventCode = '$eventID'" -computerName $computerName