From 9d0f33faee8984b53ee25c3d56a2861ffac55187 Mon Sep 17 00:00:00 2001 From: Stephan Yelle Date: Sat, 4 Jan 2025 03:28:53 -0500 Subject: [PATCH] Update SVSTaskGate.ps1 --- SVSTaskGate.ps1 | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/SVSTaskGate.ps1 b/SVSTaskGate.ps1 index 68a26ac..e7feec2 100644 --- a/SVSTaskGate.ps1 +++ b/SVSTaskGate.ps1 @@ -919,7 +919,25 @@ try { - + # Construct the command + $installCommand = "Install-DattoRMM -ApiUrl '$ApiUrl' -ApiKey '$ApiKey' -ApiSecretKey '$ApiSecretKey'" + Write-LogHybrid -Message "Executing command: $installCommand" -Level "Info" + + 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) + $response.OutputStream.Close() + } + }