Update SVSTaskGate.ps1

This commit is contained in:
2025-01-04 02:53:54 -05:00
parent a9d9df761e
commit d6e0c42db3

View File

@@ -860,10 +860,21 @@ try {
$bodyStream = New-Object IO.StreamReader $request.InputStream
$body = $bodyStream.ReadToEnd()
$selectedSite = ConvertFrom-Json $body
Invoke-Expression $selectedSite.installRMMCommand
$installCommand = $selectedSite.installRMMCommand
$responseString = "RMM install triggered."
$buffer = [System.Text.Encoding]::UTF8.GetBytes($responseString)
# Ensure API parameters are included
$installCommand += " -ApiUrl '$ApiUrl' -ApiKey '$ApiKey' -ApiSecretKey '$ApiSecretKey'"
try {
Invoke-Expression $installCommand
$responseString = "RMM install triggered successfully."
}
catch {
$responseString = "Error triggering RMM install: $($_.Exception.Message)"
}
$buffer = [System.Text.Encoding]::UTF8.GetBytes($responseString)
$response.ContentType = "text/plain"
$response.ContentLength64 = $buffer.Length
$response.OutputStream.Write($buffer, 0, $buffer.Length)
@@ -871,6 +882,7 @@ try {
}
}
"/setSVSPowerplan" {
if ($request.HttpMethod -eq "GET") {
Set-SVSPowerPlan