little cleanup
added some pauses to prevent spamming the end user invokes Fix-WindowsHealth if necessary
This commit is contained in:
@@ -25,16 +25,42 @@ If ( -not (Test-Path $BSODReport) ) { Write-Output "BSOD report was not found: $
|
||||
|
||||
# Create ticket
|
||||
Import-Module $env:SyncroModule -WarningAction SilentlyContinue
|
||||
#$BSODReportContent = [System.IO.File]::ReadAllText($BSODReport)
|
||||
$BSODReportContent = Get-Content $BSODReport
|
||||
$BSODReportContent = $BSODReportContent -join "`n"
|
||||
$BSODReportContent = Get-Content -Path $BSODReport
|
||||
$TicketSubject = 'BSOD on ' + $Env:COMPUTERNAME
|
||||
$TicketIssueType = 'Remote Support'
|
||||
$TicketStatus = 'New'
|
||||
Try {
|
||||
$TicketComment = $BSODReportContent -join "`n"
|
||||
$TicketData = Create-Syncro-Ticket -Subject $TicketSubject -IssueType $TicketIssueType -Status $TicketStatus
|
||||
Create-Syncro-Ticket-Comment -TicketIdOrNumber $TicketData.ticket.id -Subject "Issue" -Body $BSODReportContent -Hidden $true -DoNotEmail $true
|
||||
$TicketID = $TicketData.ticket.id
|
||||
Create-Syncro-Ticket-Comment -TicketIdOrNumber $TicketID -Subject "Issue" -Body $TicketComment -Hidden $true -DoNotEmail $true
|
||||
}
|
||||
Catch { Write-Error "Error creating ticket" ; Return }
|
||||
|
||||
# Evaluate BSOD report for signs that Windows needs to be repaired
|
||||
# Update the ticket
|
||||
Create-Syncro-Ticket-Comment -TicketIdOrNumber $TicketID -Subject "Update" -Body "It looks like your computer crashed. I'll get this resolved as soon as possible." -Hidden $false -DoNotEmail $false
|
||||
|
||||
# Wait a bit
|
||||
Start-Sleep -Seconds 120
|
||||
|
||||
# Setup providers for matching BSOD report content
|
||||
$ProviderMicrosoft = 'Microsoft|Windows'
|
||||
|
||||
# Get the provider data from the most recent BSOD
|
||||
$CulpritProvider = $BSODReportContent[12..13] -join '`n'
|
||||
|
||||
# Set the billable time
|
||||
$BillableTimeInMinutes = 15
|
||||
$StartAt = (Get-Date).AddMinutes(-$BillableTimeInMinutes).ToString("o")
|
||||
|
||||
Switch ( $CulpritProvider ) {
|
||||
{ $_ -match $ProviderMicrosoft } {
|
||||
$TicketComment = "I've analyzed the crash report and it indicates a problem with a Windows component. I'll repair the system now."
|
||||
Create-Syncro-Ticket-Comment -TicketIdOrNumber $TicketID -Subject "Update" -Body $TicketComment -Hidden $false -DoNotEmail $false
|
||||
Create-Syncro-Ticket-TimerEntry -TicketIdOrNumber $TicketID -StartTime $StartAt -DurationMinutes $BillableTimeInMinutes -Notes $TimerNotes -UserIdOrEmail '' -ChargeTime $true
|
||||
$FixWindowsHealth = Download-File -URL 'https://dev.emberkom.com/emberkom/management-scripts/raw/branch/master/Fix-WindowsHealth.ps1'
|
||||
Start-Sleep -Seconds 120
|
||||
. $FixWindowsHealth
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user