From b82f741a79d33d4ab96caa0b5958d50d83be0f22 Mon Sep 17 00:00:00 2001 From: David Yoder Date: Tue, 25 Jun 2024 12:04:42 -0400 Subject: [PATCH] just need to test the data that gets sent to this script --- Create-NewTicketFromAppCrash.ps1 | 46 +++++++++++++------------------- 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/Create-NewTicketFromAppCrash.ps1 b/Create-NewTicketFromAppCrash.ps1 index e2822e5..d9d1d62 100644 --- a/Create-NewTicketFromAppCrash.ps1 +++ b/Create-NewTicketFromAppCrash.ps1 @@ -1,31 +1,21 @@ # Eval the alert data -If ( -not $AlertData ) { Write-Error "No alert data provided" ; Return } +If ( -not $AlertData ) { Write-Error "No alert data provided" ; Return } Else { Write-Output $AlertData ; Return } -# 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 } +## Create ticket +#New-RMMTicket -Subject "App Crash on ${Env:COMPUTERNAME}" -InitialIssue "Application crash detected. Reason for crash indicates a Windows component is at fault." +# +## 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 }