Skip to main content

Worklet: Windows Event Viewer - Output Application and System Errors to Activity Monitor

  • February 11, 2021
  • 0 replies
  • 89 views

djvj

Gets the 10 most recent SYSTEM and APPLICATION errors from the Windows Event Viewer logs and outputs them into the Automox Activity Monitor

Evaluation Code

exit 1

Remediation Code

### Gets the 10 most recent SYSTEM errors from the event viewer logs

Write-Host "10 Most Recent SYSTEM Log Errors"

$A = Get-EventLog -LogName System -EntryType Error -Newest 10

Foreach ($B in $A){
    "`---"
    $B | Select-Object -Property TimeGenerated, EventID, EntryType, Message, Source
}


### Gets the 10 most recent APPLICATION errors from the event viewer logs
"`---" 
Write-Host "10 Most Recent APPLICATION Log Errors"
"` "
$A = Get-EventLog -LogName Application -EntryType Error -Newest 10

Foreach ($B in $A){
    "`---" 
    $B | Select-Object -Property TimeGenerated, EventID, EntryType, Message, Source
}

From there you can read in the activity monitor, or copy and paste into a text editor and

find:
---

replace with:
---

To get a cleaner view.

0 replies

Be the first to reply!

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings