just need to test the data that gets sent to this script

This commit is contained in:
2024-06-25 12:04:42 -04:00
parent 676dd0011c
commit b82f741a79
+18 -28
View File
@@ -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 }