Update SVSTaskGate.ps1
This commit is contained in:
@@ -860,10 +860,21 @@ try {
|
|||||||
$bodyStream = New-Object IO.StreamReader $request.InputStream
|
$bodyStream = New-Object IO.StreamReader $request.InputStream
|
||||||
$body = $bodyStream.ReadToEnd()
|
$body = $bodyStream.ReadToEnd()
|
||||||
$selectedSite = ConvertFrom-Json $body
|
$selectedSite = ConvertFrom-Json $body
|
||||||
Invoke-Expression $selectedSite.installRMMCommand
|
|
||||||
|
|
||||||
$responseString = "RMM install triggered."
|
$installCommand = $selectedSite.installRMMCommand
|
||||||
$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.ContentType = "text/plain"
|
||||||
$response.ContentLength64 = $buffer.Length
|
$response.ContentLength64 = $buffer.Length
|
||||||
$response.OutputStream.Write($buffer, 0, $buffer.Length)
|
$response.OutputStream.Write($buffer, 0, $buffer.Length)
|
||||||
@@ -871,6 +882,7 @@ try {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
"/setSVSPowerplan" {
|
"/setSVSPowerplan" {
|
||||||
if ($request.HttpMethod -eq "GET") {
|
if ($request.HttpMethod -eq "GET") {
|
||||||
Set-SVSPowerPlan
|
Set-SVSPowerPlan
|
||||||
|
|||||||
Reference in New Issue
Block a user