Select Page

Required Files: None


This will grab the last 300 Application and System event logs in the Error and Warning categories and attach them to the Asset.


 

Import-Module $env:SyncroModule
 
 
# Get Application Logs
$result = Get-WinEvent -Logname Application -MaxEvents 300 | Where { $_.LevelDisplayName -eq "Error" -or $_.LevelDisplayName -eq "Warning" } 
write-output $result > "c:\temp\a_event_logs.txt"
Upload-File -Subdomain "YOUR_SUBDOMAIN" -FilePath "C:\temp\a_event_logs.txt"
 
 
#Get System Logs
$result = Get-WinEvent -Logname System -MaxEvents 300 | Where { $_.LevelDisplayName -eq "Error" -or $_.LevelDisplayName -eq "Warning" } 
write-output $result > "c:\temp\s_event_logs.txt"
Upload-File -Subdomain "YOUR_SUBDOMAIN" -FilePath "C:\temp\s_event_logs.txt"
 
# Cleanup temp txt files
remove-item c:\temp\*event_logs.txt