Export Windows Event logs with PowerShell

powershell windows server

powershell windows server

1. Create a text file

2. Paste the following command in:

Get-Eventlog -LogName application -EntryType Error,Warning | Export-csv application_logs.csv | Get-Eventlog -LogName System -EntryType Error,Warning | Export-Clixml system_logs.csv

3. Save this file as windows_event_logs_dumper.ps1

When this script is ran, it pulls all of the application and system event logs, where the -EntryType is warning or error.

Going a step further, you could write a kscript that runs this script, then do a step to “Upload a file” which will upload those logs to the computer inventory for each machine the script is ran on.

0 Shares:
Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

You May Also Like