diff --git a/cleanup.ps1 b/cleanup.ps1 new file mode 100644 index 0000000..5256d4f --- /dev/null +++ b/cleanup.ps1 @@ -0,0 +1,76 @@ +$WebhookURL = "https://n8n.questcomputers.be/webhook-test/8fde21e2-937f-4142-b983-6e1606e29335" + +Add-Type -AssemblyName System.Windows.Forms + +# ---- Create the form ------------------------------------------------------- +$form = New-Object System.Windows.Forms.Form +$form.Text = "Ticket Number" +$form.Size = New-Object System.Drawing.Size(320, 160) +$form.StartPosition = "CenterScreen" +$form.Topmost = $true +$form.KeyPreview = $true # let the form see keys + +# ---- Label --------------------------------------------------------------- +$lbl = New-Object System.Windows.Forms.Label +$lbl.Location = New-Object System.Drawing.Point(15, 20) +$lbl.Size = New-Object System.Drawing.Size(280, 20) +$lbl.Text = "Enter Ticket Number:" +$form.Controls.Add($lbl) + +# ---- TextBox -------------------------------------------------------------- +$txt = New-Object System.Windows.Forms.TextBox +$txt.Location = New-Object System.Drawing.Point(15, 50) +$txt.Size = New-Object System.Drawing.Size(280, 25) +$form.Controls.Add($txt) + +# ---- OK button ----------------------------------------------------------- +$btnOK = New-Object System.Windows.Forms.Button +$btnOK.Location = New-Object System.Drawing.Point(115, 90) +$btnOK.Size = New-Object System.Drawing.Size(80, 28) +$btnOK.Text = "OK" +$btnOK.DialogResult = [System.Windows.Forms.DialogResult]::OK +$form.Controls.Add($btnOK) + +# ---- Cancel button -------------------------------------------------------- +$btnCancel = New-Object System.Windows.Forms.Button +$btnCancel.Location = New-Object System.Drawing.Point(205, 90) +$btnCancel.Size = New-Object System.Drawing.Size(80, 28) +$btnCancel.Text = "Cancel" +$btnCancel.DialogResult = [System.Windows.Forms.DialogResult]::Cancel +$form.Controls.Add($btnCancel) + +# ---- Wire up Enter/Esc ---------------------------------------------------- +$form.AcceptButton = $btnOK # Enter → OK +$form.CancelButton = $btnCancel # Esc → Cancel + +# ---- Show the dialog ------------------------------------------------------ +$result = $form.ShowDialog() + +# ---- Handle the user’s choice -------------------------------------------- +if ($result -eq [System.Windows.Forms.DialogResult]::OK) { + $ticket = $txt.Text.Trim() + + if ([string]::IsNullOrWhiteSpace($ticket)) { + Write-Host "Empty ticket – aborting." + exit + } + + # === SEND TO WEBHOOK ==================================================== + try { + $payload = @{ ticket = $ticket } | ConvertTo-Json -Compress + + $response = Invoke-RestMethod -Uri $WebhookURL -Method Post ` + -Body $payload ` + -ContentType "application/json" ` + -ErrorAction Stop + + Write-Host "✅ Ticket $ticket sent successfully." + Write-Host "Webhook response:`n$($response | ConvertTo-Json -Compress)" + } + catch { + Write-Error "❌ Failed to send ticket: $_" + } +} +else { + Write-Host "User cancelled - nothing sent." +} \ No newline at end of file diff --git a/pc_information.ps1 b/pc_information.ps1 new file mode 100644 index 0000000..0956d4d --- /dev/null +++ b/pc_information.ps1 @@ -0,0 +1 @@ +Get-WmiObject -Namespace "root\SecurityCenter2" -Class AntiVirusProduct | Select-Object -Property displayName, pathToSignedProductExe | ConvertTo-Json \ No newline at end of file