Update TGBeta.ps1

This commit is contained in:
2025-01-05 19:30:22 -05:00
parent af9905249a
commit cb486e014e

View File

@@ -698,8 +698,12 @@ function GetHtmlContent {
function triggerInstall() {
const dropdown = document.getElementById('dattoRmmDropdown');
const UID = dropdown.options[dropdown.selectedIndex].value
const Name = dropdown.options[dropdown.selectedIndex].text
const UID = dropdown && dropdown.options[dropdown.selectedIndex]
? dropdown.options[dropdown.selectedIndex].value
: null;
const Name = dropdown && dropdown.options[dropdown.selectedIndex]
? dropdown.options[dropdown.selectedIndex].text
: "Unknown Site";
const setSVSPowerplan = document.querySelector('input[name="setSVSPowerplan"]');
const installSVSMSPModule = document.querySelector('input[name="installSVSMSPModule"]');
@@ -711,19 +715,16 @@ function GetHtmlContent {
const installThreatLocker = document.querySelector('input[name="installThreatLocker"]');
const installRocketCyber = document.querySelector('input[name="installRocketCyber"]');
// Priority 1: Install SVSMSP Module
if (installSVSMSPModule.checked) {
appendLog("Installing SVSMSP Module (Priority 1)...", "cyan");
fetch('/installSVSMSPModule', { method: 'GET' })
.then(() => appendLog("SVSMSP Module installed successfully.", "green"))
.catch(error => appendLog(`Error installing SVSMSP Module: ${error.message}`, "red"));
return; // Stop further execution as this is the highest priority
// Ensure UID is selected before proceeding
if (!UID) {
appendLog("Please select a site from the dropdown.", "red");
return;
}
// Priority 2: Install DattoRMM
// Install DattoRMM if checked
if (installDattoRMM.checked) {
const DattoRMMCheckbox = document.querySelectorAll('input[name="dattoRMMOption"]:checked');
appendLog("Installing selected site RMM (Priority 2)...", "cyan");
appendLog("Installing selected site RMM...", "cyan");
const checkedValues = Array.from(DattoRMMCheckbox).map(c => c.value);
@@ -740,16 +741,21 @@ function GetHtmlContent {
})
.then(() => appendLog("Datto RMM installation triggered successfully.", "green"))
.catch(error => appendLog(`Error installing Datto RMM: ${error.message}`, "red"));
return; // Stop further execution as this is the second highest priority
}
// Lower-priority tasks
// Execute lower-priority tasks sequentially
if (setSVSPowerplan.checked) {
fetch('/SetSVSPowerplan', { method: 'GET' })
.then(() => appendLog("SVS Powerplan set successfully.", "green"))
.catch(error => appendLog(`Error setting SVS Powerplan: ${error.message}`, "red"));
}
if (installSVSMSPModule.checked) {
fetch('/installSVSMSPModule', { method: 'GET' })
.then(() => appendLog("SVSMSP Module installed successfully.", "green"))
.catch(error => appendLog(`Error installing SVSMSP Module: ${error.message}`, "red"));
}
if (installCyberQP.checked) {
fetch('/installCyberQP', { method: 'GET' })
.then(() => appendLog("CyberQP installed successfully.", "green"))
@@ -785,7 +791,8 @@ function GetHtmlContent {
.then(() => appendLog("RocketCyber installed successfully.", "green"))
.catch(error => appendLog(`Error installing RocketCyber: ${error.message}`, "red"));
}
}
}