Forum Discussion

philp1300's avatar
philp1300
Copper Contributor
Nov 07, 2020
Solved

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.

  • philp1300 

    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

  • farismalaeb's avatar
    farismalaeb
    Iron Contributor

    philp1300 

    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"}

     

Resources