29 lines
1.7 KiB
PowerShell
29 lines
1.7 KiB
PowerShell
# Create ticket
|
|
Import-Module $env:SyncroModule -WarningAction SilentlyContinue
|
|
$TicketSubject = 'App Crash on ' + $Env:COMPUTERNAME
|
|
$TicketIssueType = 'Remote Support'
|
|
$TicketStatus = 'New'
|
|
Try {
|
|
$TicketData = Create-Syncro-Ticket -Subject $TicketSubject -IssueType $TicketIssueType -Status $TicketStatus
|
|
$TicketID = $TicketData.ticket.id
|
|
$TicketComment = "Application crash detected. Reason for crash indicates a Windows component is at fault."
|
|
Create-Syncro-Ticket-Comment -TicketIdOrNumber $TicketID -Subject "Issue" -Body $TicketComment -Hidden $true -DoNotEmail $true
|
|
}
|
|
Catch { Write-Error "Error creating ticket" ; Return }
|
|
|
|
# Update the ticket
|
|
$TicketComment = "It looks like an app crashed on your computer, and the reason for the crash indicates a Windows component is at fault.`n`nI'll repair your system now."
|
|
Create-Syncro-Ticket-Comment -TicketIdOrNumber $TicketID -Subject "Update" -Body $TicketComment -Hidden $false -DoNotEmail $false
|
|
|
|
# Bill time to the ticket
|
|
$BillableTimeInMinutes = 15
|
|
$StartAt = (Get-Date).AddMinutes(-$BillableTimeInMinutes).ToString("o")
|
|
$TimeEntryNote = "Analysis indicates crash caused by Windows component(s). Scanning and repairing corruption in the system."
|
|
Create-Syncro-Ticket-TimerEntry -TicketIdOrNumber $TicketID -StartTime $StartAt -DurationMinutes $BillableTimeInMinutes -Notes $TimeEntryNote -UserIdOrEmail $TimeAttributedToUser -ChargeTime "true"
|
|
|
|
# Fix Windows Health
|
|
$FixWindowsHealth = Download-File -URL 'https://dev.emberkom.com/emberkom/management-scripts/raw/branch/master/Fix-WindowsHealth.ps1'
|
|
. $FixWindowsHealth
|
|
If ( Test-Path $FixWindowsHealth ) { Remove-Item $FixWindowsHealth -Force -ErrorAction SilentlyContinue }
|
|
|