diff --git a/SVSTaskGate.ps1 b/SVSTaskGate.ps1 index f7dd852..c3cffa4 100644 --- a/SVSTaskGate.ps1 +++ b/SVSTaskGate.ps1 @@ -856,37 +856,22 @@ try { } } - - "/installrmm" { if ($request.HttpMethod -eq "POST") { $bodyStream = New-Object IO.StreamReader $request.InputStream $body = $bodyStream.ReadToEnd() - $selectedSite = ConvertFrom-Json $body + $requestData = ConvertFrom-Json $body - # Extract parameters - #$ApiUrl = $selectedSite.ApiUrl - #$ApiKey = $selectedSite.ApiKey - #$ApiSecretKey = $selectedSite.ApiSecretKey + $installRMMCommand = $requestData.installRMMCommand + $UID = $requestData.UID + $Name = $requestData.Name - # Verify required parameters - if (-not $ApiUrl -or -not $ApiKey -or -not $ApiSecretKey) { - $responseString = "Error: Missing required parameters. ApiUrl='$ApiUrl', ApiKey='$ApiKey', ApiSecretKey='$ApiSecretKey'" - $buffer = [System.Text.Encoding]::UTF8.GetBytes($responseString) - $response.ContentType = "text/plain" - $response.ContentLength64 = $buffer.Length - $response.OutputStream.Write($buffer, 0, $buffer.Length) - $response.OutputStream.Close() - return - } - - # Construct the command - $installCommand = "Install-DattoRMM -ApiUrl '$ApiUrl' -ApiKey '$ApiKey' -ApiSecretKey '$ApiSecretKey'" - Write-LogHybrid -Message "Executing command: $installCommand" -Level "Info" + # Log the received command + Write-LogHybrid -Message "Received command: $installRMMCommand for UID: $UID, Name: $Name" -Level "Info" try { - Invoke-Expression $installCommand - $responseString = "RMM install triggered successfully." + Invoke-Expression $installRMMCommand + $responseString = "RMM install triggered successfully for UID: $UID, Name: $Name." } catch { $responseString = "Error triggering RMM install: $($_.Exception.Message)" @@ -900,6 +885,9 @@ try { } } + + + "/setSVSPowerplan" {