Update SVSTaskGate.ps1
This commit is contained in:
@@ -686,13 +686,18 @@ function GetHtmlContent {
|
|||||||
const installThreatLocker = document.querySelector('input[name="installThreatlocker"]');
|
const installThreatLocker = document.querySelector('input[name="installThreatlocker"]');
|
||||||
const installRocketCyber = document.querySelector('input[name="installRocketCyber"]');
|
const installRocketCyber = document.querySelector('input[name="installRocketCyber"]');
|
||||||
|
|
||||||
if (installDattoRMM.checked) {
|
if (installDattoRMM.checked) {
|
||||||
|
// Get the checked options for Datto RMM
|
||||||
const DattoRMMCheckbox = document.querySelectorAll('input[name="dattoRMMOption"]:checked');
|
const DattoRMMCheckbox = document.querySelectorAll('input[name="dattoRMMOption"]:checked');
|
||||||
appendLog("Installing selected site RMM...", "cyan");
|
appendLog("Installing selected site RMM...", "cyan");
|
||||||
|
|
||||||
|
// Map the selected checkboxes to their values
|
||||||
const checkedValues = Array.from(DattoRMMCheckbox).map(c => c.value);
|
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')) {
|
if (checkedValues.includes('inputVar')) {
|
||||||
installRMMCommand += ' -PushSiteVars';
|
installRMMCommand += ' -PushSiteVars';
|
||||||
}
|
}
|
||||||
@@ -703,18 +708,39 @@ function GetHtmlContent {
|
|||||||
installRMMCommand += ' -SaveCopy';
|
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', {
|
fetch('/installrmm', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
installRMMCommand, "Install-DattoRMM http://proget.svstools.ca:8083/nuget/SVS_Repo/ -ApiKey TMM2F65NR81TR2N2MOUQI5KGC0TELPO -ApikeysecretKey PRB1NSQJ14ISDB00C49LRO2GR3J33RN5"
|
"installRMMCommand": installRMMCommand,
|
||||||
UID, "9f90bdc8-38fe-4cc6-af6d-c014569b96e3"
|
"UID": UID,
|
||||||
Name, "Sytech"
|
"Name": Name,
|
||||||
ApiUrl, "http://proget.svstools.ca:8083/nuget/SVS_Repo/"
|
"ApiUrl": ApiUrl,
|
||||||
ApiKey, "TMM2F65NR81TR2N2MOUQI5KGC0TELPO"
|
"ApiKey": ApiKey,
|
||||||
ApiSecretKey "PRB1NSQJ14ISDB00C49LRO2GR3J33RN5"
|
"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(response => response.text())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
console.log('RMM Installation Request Sent:', data); // Log confirmation in browser console
|
console.log('RMM Installation Request Sent:', data); // Log confirmation in browser console
|
||||||
|
|||||||
Reference in New Issue
Block a user