Update SVSTaskGate.ps1
This commit is contained in:
@@ -708,9 +708,26 @@ function GetHtmlContent {
|
|||||||
fetch('/installrmm', {
|
fetch('/installrmm', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({ installRMMCommand, UID, Name, ApiUrl, ApiKey, ApiSecretKey })
|
body: JSON.stringify({
|
||||||
|
installRMMCommand,
|
||||||
|
UID,
|
||||||
|
Name,
|
||||||
|
ApiUrl,
|
||||||
|
ApiKey,
|
||||||
|
ApiSecretKey
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.then(response => response.text())
|
||||||
|
.then(data => {
|
||||||
|
console.log('RMM Installation Request Sent:', data); // Log confirmation in browser console
|
||||||
|
appendLog("Installation request sent to backend.", "green");
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('Error:', error);
|
||||||
|
appendLog("Error sending installation request to backend: " + error.message, "red");
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|
||||||
if (document.querySelector('input[name="setSVSPowerplan"]').checked) {
|
if (document.querySelector('input[name="setSVSPowerplan"]').checked) {
|
||||||
fetch('/installSVSPowerplan', { method: 'GET' });
|
fetch('/installSVSPowerplan', { method: 'GET' });
|
||||||
@@ -848,9 +865,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."
|
# Log the received request for debugging
|
||||||
|
Write-LogHybrid -Message "Received RMM installation request: $($selectedSite | ConvertTo-Json)" -Level "Info"
|
||||||
|
Write-LogHybrid -Message "Starting installation for site $($selectedSite.Name) ($($selectedSite.UID))..." -Level "Info"
|
||||||
|
|
||||||
|
# Execute the installation command
|
||||||
|
try {
|
||||||
|
Invoke-Expression $selectedSite.installRMMCommand
|
||||||
|
Write-LogHybrid -Message "Installation for site $($selectedSite.Name) ($($selectedSite.UID)) completed successfully." -Level "Success"
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-LogHybrid -Message "Error during installation for site $($selectedSite.Name): $($_.Exception.Message)" -Level "Error"
|
||||||
|
}
|
||||||
|
|
||||||
|
$responseString = "RMM installation triggered for site $($selectedSite.Name)."
|
||||||
$buffer = [System.Text.Encoding]::UTF8.GetBytes($responseString)
|
$buffer = [System.Text.Encoding]::UTF8.GetBytes($responseString)
|
||||||
$response.ContentType = "text/plain"
|
$response.ContentType = "text/plain"
|
||||||
$response.ContentLength64 = $buffer.Length
|
$response.ContentLength64 = $buffer.Length
|
||||||
|
|||||||
Reference in New Issue
Block a user