From 298b8ef0503d220c8022f4fda5d1aded741acad6 Mon Sep 17 00:00:00 2001 From: David Yoder Date: Thu, 18 Jul 2024 15:42:41 -0400 Subject: [PATCH] exit early if the BSOD report is empty --- Create-NewTicketFromBSODAnalysis.ps1 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Create-NewTicketFromBSODAnalysis.ps1 b/Create-NewTicketFromBSODAnalysis.ps1 index 3a549ca..d83528d 100644 --- a/Create-NewTicketFromBSODAnalysis.ps1 +++ b/Create-NewTicketFromBSODAnalysis.ps1 @@ -17,6 +17,13 @@ For ($i = 0; $i -lt 1200; $i++) { # Exit if the BSOD report was not created If ( !(Test-Path $BSODReport) ) { Write-Output "BSOD report was not found: ${BSODReport}" ; Return } +# Exit if the BSOD report is empty +If ( (Get-Content -Path $BSODReport).Length -eq 0 ) { + Write-Output "BSOD report is empty: ${BSODReport}" + Remove-Item $BSODReport -Force + Return +} + # Create ticket $BSODReportContent = $(Get-Content -Path $BSODReport) -join "`n" New-RMMTicket -Subject "System Crash on ${Env:COMPUTERNAME}" -InitialIssue $BSODReportContent