Changed script
This commit is contained in:
parent
12952dd14e
commit
574bc22a9b
1 changed files with 6 additions and 5 deletions
11
cleanup.ps1
11
cleanup.ps1
|
|
@ -1,14 +1,15 @@
|
||||||
|
$ScriptTitle = "Quest Computers Cleanup"
|
||||||
$WebhookURL = "https://n8n.questcomputers.be/webhook-test/8fde21e2-937f-4142-b983-6e1606e29335"
|
$WebhookURL = "https://n8n.questcomputers.be/webhook-test/8fde21e2-937f-4142-b983-6e1606e29335"
|
||||||
|
|
||||||
Add-Type -AssemblyName System.Windows.Forms
|
Add-Type -AssemblyName System.Windows.Forms
|
||||||
|
|
||||||
# ---- Create the form -------------------------------------------------------
|
# ---- Create the form -------------------------------------------------------
|
||||||
$form = New-Object System.Windows.Forms.Form
|
$form = New-Object System.Windows.Forms.Form
|
||||||
$form.Text = "Ticket Number"
|
$form.Text = $ScriptTitle
|
||||||
$form.Size = New-Object System.Drawing.Size(320, 160)
|
$form.Size = New-Object System.Drawing.Size(320, 160)
|
||||||
$form.StartPosition = "CenterScreen"
|
$form.StartPosition = "CenterScreen"
|
||||||
$form.Topmost = $true
|
$form.Topmost = $true
|
||||||
$form.KeyPreview = $true # let the form see keys
|
$form.KeyPreview = $true
|
||||||
|
|
||||||
# ---- Label ---------------------------------------------------------------
|
# ---- Label ---------------------------------------------------------------
|
||||||
$lbl = New-Object System.Windows.Forms.Label
|
$lbl = New-Object System.Windows.Forms.Label
|
||||||
|
|
@ -51,7 +52,7 @@ if ($result -eq [System.Windows.Forms.DialogResult]::OK) {
|
||||||
$ticket = $txt.Text.Trim()
|
$ticket = $txt.Text.Trim()
|
||||||
|
|
||||||
if ([string]::IsNullOrWhiteSpace($ticket)) {
|
if ([string]::IsNullOrWhiteSpace($ticket)) {
|
||||||
Write-Host "Empty ticket – aborting."
|
Write-Host "Empty ticket - aborting."
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -64,11 +65,11 @@ if ($result -eq [System.Windows.Forms.DialogResult]::OK) {
|
||||||
-ContentType "application/json" `
|
-ContentType "application/json" `
|
||||||
-ErrorAction Stop
|
-ErrorAction Stop
|
||||||
|
|
||||||
Write-Host "✅ Ticket $ticket sent successfully."
|
Write-Host "Ticket $ticket sent successfully."
|
||||||
Write-Host "Webhook response:`n$($response | ConvertTo-Json -Compress)"
|
Write-Host "Webhook response:`n$($response | ConvertTo-Json -Compress)"
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Write-Error "❌ Failed to send ticket: $_"
|
Write-Error "Failed to send ticket: $_"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue