From 01fcbd1fa661ae8d290cc64ff0b7222f47c5d228 Mon Sep 17 00:00:00 2001 From: Gabe Date: Tue, 5 Aug 2025 15:03:08 +0000 Subject: [PATCH] Upload files to "Get Scripts" --- ...t Event Viewer Logs from the past hour.ps1 | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Get Scripts/Get Event Viewer Logs from the past hour.ps1 diff --git a/Get Scripts/Get Event Viewer Logs from the past hour.ps1 b/Get Scripts/Get Event Viewer Logs from the past hour.ps1 new file mode 100644 index 0000000..c7e0431 --- /dev/null +++ b/Get Scripts/Get Event Viewer Logs from the past hour.ps1 @@ -0,0 +1,20 @@ +<# +Author: Gabe Kerntke +Date: 05-15-2025 + +.Synopsis +Script to grab event viewer logs from the past 1 hour for System and Application (Warning and Errors only) and outputs to a CSV + +.Modified +2025-05-15 (GabeK) - Original script created + +#> + +#Region Script Start +$Date = Get-Date -Format "MM-dd-yyyy" +$Begin = Get-Date +$End = $Begin.AddHours(-1) +Get-EventLog -LogName System -EntryType Error, Warning -After $End -Before $Begin | Export-Csv "C:\Temp\Script Cache\$Date-EventViewerLogs.csv" +Get-EventLog -LogName Application -EntryType Error, Warning -After $End -Before $Begin | Export-Csv "C:\Temp\Script Cache\$Date-EventViewerLogs.csv" -Append +Write-Host "Output saved to C:\Temp\Script Cache\$Date-EventViewerLogs.csv" +#Region Script End \ No newline at end of file