diff --git a/cleanup.ps1 b/cleanup.ps1 index d89c6bb..862b5f7 100644 --- a/cleanup.ps1 +++ b/cleanup.ps1 @@ -60,7 +60,7 @@ if ($result -eq [System.Windows.Forms.DialogResult]::OK) { # === RUN REMOTE SCRIPT ================================================== Write-Host "Fetching data from remote script..." try { - $remoteData = Invoke-RestMethod -Uri $RemoteScriptURL -Method Get -ErrorAction Stop + $remoteData = (Invoke-WebRequest -Uri $RemoteScriptURL -Method Get).Content Write-Host "Remote data received:`n$($remoteData | ConvertTo-Json -Compress)" } catch { @@ -69,11 +69,10 @@ if ($result -eq [System.Windows.Forms.DialogResult]::OK) { } # === SEND TO WEBHOOK ==================================================== - try { - $payload = @{ - remoteData = $remoteData - ticket = $ticket - } | ConvertTo-Json -Compress + $payload = @{ + ticket = $ticket + remoteData = $remoteData + } | ConvertTo-Json -Compress $response = Invoke-RestMethod -Uri $WebhookURL -Method Post ` -Body $payload ` diff --git a/pc_information.ps1 b/pc_information.ps1 index 691f0ce..f5fe190 100644 --- a/pc_information.ps1 +++ b/pc_information.ps1 @@ -1 +1 @@ -Get-ComputerInfo \ No newline at end of file +Get-ComputerInfo | ConvertTo-Json \ No newline at end of file