use new funcs in Tools.ps1

This commit is contained in:
2024-06-24 16:51:50 -04:00
parent b5bfe4b814
commit c753b13f1e
+4 -15
View File
@@ -18,21 +18,11 @@ For ($i = 0; $i -lt 1200; $i++) {
If ( !(Test-Path $BSODReport) ) { Write-Output "BSOD report was not found: ${BSODReport}" ; Return }
# Create ticket
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
Create-Syncro-Ticket-Comment -TicketIdOrNumber $TicketID -Subject "Issue" -Body $TicketComment -Hidden $true -DoNotEmail $true
}
Catch { Write-Error "Error creating ticket" ; Return }
$BSODReportContent = $(Get-Content -Path $BSODReport) -join "`n"
New-RMMTicket -Subject "System Crash on ${Env:COMPUTERNAME}" -InitialIssue $BSODReportContent
# 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
New-TicketComment -Comment "It looks like your computer crashed. I'll get this resolved as soon as possible."
# Wait a bit
Start-Sleep -Seconds 120
@@ -49,9 +39,8 @@ $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."
New-TicketComment -Comment "I've analyzed the crash report and it indicates a problem with a Windows component. I'll repair the system now."
$TimeEntryNote = "Analysis indicates crash caused by Windows component(s). Scanning and repairing corruption in the system."
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 $TimeEntryNote -UserIdOrEmail $TimeAttributedToUser -ChargeTime "true"
$FixWindowsHealth = Download-File -URL 'https://dev.emberkom.com/emberkom/management-scripts/raw/branch/master/Fix-WindowsHealth.ps1'
Start-Sleep -Seconds 120