Forum Discussion
Evaluating Windows Application log
I am trying to evaluate the Windows Application log. Specifically Source = Windows Backup. I am running the following Script which produces the results I am looking for.
$q = get-eventlog -logname application -source 'windows backup' -newest 1
$q | select-object -property entrytype, instanceid
This produces the desired results:
Now what I need to do is evaluate if Entrytype is anything other than "Information" or if InstanceID is anything other than "4098". If either evaluation is true then I send an email to myself to investigate. How do I do that evaluation? I already know how to send the email. Any help would be appreciated.
when it comes to evaluation, your friend should be If ( this ) {action}
$q = get-eventlog -logname application -source 'edgeupdate' -newest 1 if ($q.EntryType -like "Information"){ Write-Host "do whatever action"}
3 Replies
- farismalaebIron Contributor
when it comes to evaluation, your friend should be If ( this ) {action}
$q = get-eventlog -logname application -source 'edgeupdate' -newest 1 if ($q.EntryType -like "Information"){ Write-Host "do whatever action"}
- philp1300Copper Contributor
ok thanks I think I can work with that.
- farismalaebIron Contributor