Update SVSTaskGate.ps1
This commit is contained in:
@@ -687,12 +687,17 @@ function GetHtmlContent {
|
||||
const installRocketCyber = document.querySelector('input[name="installRocketCyber"]');
|
||||
|
||||
if (installDattoRMM.checked) {
|
||||
// Get the checked options for Datto RMM
|
||||
const DattoRMMCheckbox = document.querySelectorAll('input[name="dattoRMMOption"]:checked');
|
||||
appendLog("Installing selected site RMM...", "cyan");
|
||||
|
||||
// Map the selected checkboxes to their values
|
||||
const checkedValues = Array.from(DattoRMMCheckbox).map(c => c.value);
|
||||
let installRMMCommand = 'Install-DattoRMM -ApiUrl $ApiUrl -ApiKey $ApiKey -ApiSecretKey $ApiSecretKey';
|
||||
|
||||
// Build the base command
|
||||
let installRMMCommand = `Install-DattoRMM ${ApiUrl} -ApiKey ${ApiKey} -ApiSecretKey ${ApiSecretKey}`;
|
||||
|
||||
// Append optional flags based on user selection
|
||||
if (checkedValues.includes('inputVar')) {
|
||||
installRMMCommand += ' -PushSiteVars';
|
||||
}
|
||||
@@ -703,18 +708,39 @@ function GetHtmlContent {
|
||||
installRMMCommand += ' -SaveCopy';
|
||||
}
|
||||
|
||||
// Log the full command for debugging purposes
|
||||
console.log("Generated command:", installRMMCommand);
|
||||
|
||||
// Send the command and site details to the backend
|
||||
fetch('/installrmm', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
installRMMCommand, "Install-DattoRMM http://proget.svstools.ca:8083/nuget/SVS_Repo/ -ApiKey TMM2F65NR81TR2N2MOUQI5KGC0TELPO -ApikeysecretKey PRB1NSQJ14ISDB00C49LRO2GR3J33RN5"
|
||||
UID, "9f90bdc8-38fe-4cc6-af6d-c014569b96e3"
|
||||
Name, "Sytech"
|
||||
ApiUrl, "http://proget.svstools.ca:8083/nuget/SVS_Repo/"
|
||||
ApiKey, "TMM2F65NR81TR2N2MOUQI5KGC0TELPO"
|
||||
ApiSecretKey "PRB1NSQJ14ISDB00C49LRO2GR3J33RN5"
|
||||
"installRMMCommand": installRMMCommand,
|
||||
"UID": UID,
|
||||
"Name": Name,
|
||||
"ApiUrl": ApiUrl,
|
||||
"ApiKey": ApiKey,
|
||||
"ApiSecretKey": ApiSecretKey
|
||||
})
|
||||
})
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error(`Server responded with status ${response.status}`);
|
||||
}
|
||||
return response.text();
|
||||
})
|
||||
.then(data => {
|
||||
console.log('RMM Installation Request Sent:', data); // Log success in console
|
||||
appendLog("Installation request sent to backend successfully.", "green");
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
appendLog(`Error sending installation request to backend: ${error.message}`, "red");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
.then(response => response.text())
|
||||
.then(data => {
|
||||
console.log('RMM Installation Request Sent:', data); // Log confirmation in browser console
|
||||
|
||||
Reference in New Issue
Block a user