wait 20min for bsod report to be generated

don't download BlueScreenView, expect it
move all of ticket creation into try block
This commit is contained in:
2024-06-17 17:04:16 -04:00
parent 05da2d726e
commit c078638e1d
+9 -15
View File
@@ -1,35 +1,29 @@
$BlueScreenView = $Global:MSPToolsDirectory + '\BlueScreenView.exe'
If ( Is64Bit ) { $BlueScreenView = $Global:MSPToolsDirectory + '\BlueScreenView-x64.exe' } Else { $BlueScreenView = $Global:MSPToolsDirectory + '\BlueScreenView-x86.exe' }
$BSODReport = $Global:OutputDirectory + '\BSODReport.txt'
# Remove existing BSOD report
If ( Test-Path $BSODReport ) { Remove-Item $BSODReport -Force -ErrorAction SilentlyContinue }
# Download BlueScreenView
If ( -not (Test-Path $BlueScreenView) ) {
If ( Is64Bit ) { $URL = 'https://www.emberkom.com/tools/BlueScreenView-x64.exe' } Else { $URL = 'https://www.emberkom.com/tools/BlueScreenView-x86.exe' }
Download-File -URL $URL -File $BlueScreenView
If ( -not (Test-Path $BlueScreenView) ) { Return }
}
# Run BlueScreenView
If ( !(Test-Path $BlueScreenView) ) { Write-Error "File does not exist: ${BlueScreenView}" ; Return }
Start-Process $BlueScreenView -ArgumentList "/stext $BSODReport /sort ~1" -Wait
# Wait for BSOD report
For ($i = 0; $i -lt 300; $i++) {
For ($i = 0; $i -lt 1200; $i++) {
If ( Test-Path $BSODReport ) { Break }
Start-Sleep -Seconds 1
}
# Exit if the BSOD report was not created
If ( -not (Test-Path $BSODReport) ) { Write-Output "BSOD report was not found: ${BSODReport}" ; Return }
If ( !(Test-Path $BSODReport) ) { Write-Output "BSOD report was not found: ${BSODReport}" ; Return }
# Create ticket
Import-Module $env:SyncroModule -WarningAction SilentlyContinue
$BSODReportContent = Get-Content -Path $BSODReport
$TicketSubject = 'System Crash on ' + $Env:COMPUTERNAME
$TicketIssueType = 'Remote Support'
$TicketStatus = 'New'
Try {
Import-Module $env:SyncroModule -WarningAction SilentlyContinue
$BSODReportContent = Get-Content -Path $BSODReport
$TicketSubject = 'System Crash on ' + $Env:COMPUTERNAME
$TicketIssueType = 'Remote Support'
$TicketStatus = 'New'
$TicketComment = $BSODReportContent -join "`n"
$TicketData = Create-Syncro-Ticket -Subject $TicketSubject -IssueType $TicketIssueType -Status $TicketStatus
$TicketID = $TicketData.ticket.id