Added pc_information

This commit is contained in:
Joeri 2026-02-20 14:08:40 +01:00
parent f9abb61d9c
commit 2659e5225a

View file

@ -1,9 +1,10 @@
$ScriptTitle = "Cleanup Script" $ScriptTitle = "Cleanup Script"
$WebhookURL = "https://n8n.questcomputers.be/webhook-test/8fde21e2-937f-4142-b983-6e1606e29335" $WebhookURL = "https://n8n.questcomputers.be/webhook-test/8fde21e2-937f-4142-b983-6e1606e29335"
$RemoteScriptURL = "https://git.questcomputers.be/quest-scripts/scripts/raw/branch/main/cleanup.ps1"
Add-Type -AssemblyName System.Windows.Forms Add-Type -AssemblyName System.Windows.Forms
# ---- Create the form ------------------------------------------------------- # Form
$form = New-Object System.Windows.Forms.Form $form = New-Object System.Windows.Forms.Form
$form.Text = $ScriptTitle $form.Text = $ScriptTitle
$form.Size = New-Object System.Drawing.Size(320, 160) $form.Size = New-Object System.Drawing.Size(320, 160)
@ -11,20 +12,20 @@ $form.StartPosition = "CenterScreen"
$form.Topmost = $true $form.Topmost = $true
$form.KeyPreview = $true $form.KeyPreview = $true
# ---- Label --------------------------------------------------------------- # Form label
$lbl = New-Object System.Windows.Forms.Label $lbl = New-Object System.Windows.Forms.Label
$lbl.Location = New-Object System.Drawing.Point(15, 20) $lbl.Location = New-Object System.Drawing.Point(15, 20)
$lbl.Size = New-Object System.Drawing.Size(280, 20) $lbl.Size = New-Object System.Drawing.Size(280, 20)
$lbl.Text = "Enter Ticket Number:" $lbl.Text = "Enter Ticket Number:"
$form.Controls.Add($lbl) $form.Controls.Add($lbl)
# ---- TextBox -------------------------------------------------------------- # Form textbox
$txt = New-Object System.Windows.Forms.TextBox $txt = New-Object System.Windows.Forms.TextBox
$txt.Location = New-Object System.Drawing.Point(15, 50) $txt.Location = New-Object System.Drawing.Point(15, 50)
$txt.Size = New-Object System.Drawing.Size(280, 25) $txt.Size = New-Object System.Drawing.Size(280, 25)
$form.Controls.Add($txt) $form.Controls.Add($txt)
# ---- OK button ----------------------------------------------------------- # Form OK button
$btnOK = New-Object System.Windows.Forms.Button $btnOK = New-Object System.Windows.Forms.Button
$btnOK.Location = New-Object System.Drawing.Point(115, 90) $btnOK.Location = New-Object System.Drawing.Point(115, 90)
$btnOK.Size = New-Object System.Drawing.Size(80, 28) $btnOK.Size = New-Object System.Drawing.Size(80, 28)
@ -32,7 +33,7 @@ $btnOK.Text = "OK"
$btnOK.DialogResult = [System.Windows.Forms.DialogResult]::OK $btnOK.DialogResult = [System.Windows.Forms.DialogResult]::OK
$form.Controls.Add($btnOK) $form.Controls.Add($btnOK)
# ---- Cancel button -------------------------------------------------------- # Form Cancel button
$btnCancel = New-Object System.Windows.Forms.Button $btnCancel = New-Object System.Windows.Forms.Button
$btnCancel.Location = New-Object System.Drawing.Point(205, 90) $btnCancel.Location = New-Object System.Drawing.Point(205, 90)
$btnCancel.Size = New-Object System.Drawing.Size(80, 28) $btnCancel.Size = New-Object System.Drawing.Size(80, 28)
@ -40,14 +41,14 @@ $btnCancel.Text = "Cancel"
$btnCancel.DialogResult = [System.Windows.Forms.DialogResult]::Cancel $btnCancel.DialogResult = [System.Windows.Forms.DialogResult]::Cancel
$form.Controls.Add($btnCancel) $form.Controls.Add($btnCancel)
# ---- Wire up Enter/Esc ---------------------------------------------------- # Wire up Enter/Esc
$form.AcceptButton = $btnOK # Enter → OK $form.AcceptButton = $btnOK # Enter → OK
$form.CancelButton = $btnCancel # Esc → Cancel $form.CancelButton = $btnCancel # Esc → Cancel
# ---- Show the dialog ------------------------------------------------------ # Show the dialog
$result = $form.ShowDialog() $result = $form.ShowDialog()
# ---- Handle the users choice -------------------------------------------- # Handle the users choice
if ($result -eq [System.Windows.Forms.DialogResult]::OK) { if ($result -eq [System.Windows.Forms.DialogResult]::OK) {
$ticket = $txt.Text.Trim() $ticket = $txt.Text.Trim()
@ -56,6 +57,17 @@ if ($result -eq [System.Windows.Forms.DialogResult]::OK) {
exit exit
} }
# === RUN REMOTE SCRIPT ==================================================
Write-Host "Fetching data from remote script..."
try {
$remoteData = Invoke-RestMethod -Uri $RemoteScriptURL -Method Get -ErrorAction Stop
Write-Host "Remote data received:`n$($remoteData | ConvertTo-Json -Compress)"
}
catch {
Write-Error "Failed to fetch remote script: $_"
exit
}
# === SEND TO WEBHOOK ==================================================== # === SEND TO WEBHOOK ====================================================
try { try {
$payload = @{ ticket = $ticket } | ConvertTo-Json -Compress $payload = @{ ticket = $ticket } | ConvertTo-Json -Compress