From b43eb95e98335a1bc4915b55e1e2997b24d2536b Mon Sep 17 00:00:00 2001 From: Stephan Yelle Date: Tue, 7 Jan 2025 23:59:49 -0500 Subject: [PATCH] Update TGBeta.ps1 --- TGBeta.ps1 | 195 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 125 insertions(+), 70 deletions(-) diff --git a/TGBeta.ps1 b/TGBeta.ps1 index e3c51ba..d51b54e 100644 --- a/TGBeta.ps1 +++ b/TGBeta.ps1 @@ -1,17 +1,18 @@ ### To Modify of January 5 2025 -### set the priority in the js code so it waits for one function to complete before starting the next one + ### let's start thinking about the write-log -TaskCategory "On-boarding" or "Off-boarding" ### need new logo and the RGB color codes form john ### add the .net silent install tweaks to toolkit ### for the reg tweak need to do/undo function maybe it should have it own check box list ### new tab for client apps? -### need to add the set-DefaultEdgeSearchProvider to the module +### the set-DefaultEdgeSearchProvider will be added to the module v 25.1.8 ############################################################# ### Changes done +### priorities are set for the install order as far as 1 svsmsp module,2 datto rmm, 3 the rest ### added the Tweaks and Offboard buttons ### added the Set-DefaultEdgeSearchProvider ### minor change the the param of install-svsmsp @@ -847,78 +848,131 @@ function GetHtmlContent { appendLog('Error:' + error.message, "red"); } } + - function triggerInstall() { + function triggerInstall() { const dropdown = document.getElementById('dattoRmmDropdown'); - const UID = dropdown.options[dropdown.selectedIndex]?.value || null; - const Name = dropdown.options[dropdown.selectedIndex]?.text || null; + 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 + : null; - const setSVSPowerplan = document.querySelector('input[name="setSVSPowerplan"]'); - const installSVSMSPModule = document.querySelector('input[name="installSVSMSPModule"]'); - const installDattoRMM = document.querySelector('input[name="installDattoRMM"]'); - const installCyberQP = document.querySelector('input[name="installCyberQP"]'); - const installSplashtop = document.querySelector('input[name="installSplashtop"]'); - const installSVSHelpDesk = document.querySelector('input[name="installSVSHelpDesk"]'); - const installSVSWatchtower = document.querySelector('input[name="installSVSWatchtower"]'); - 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' }) + (async () => { + // Priority 1: Install SVSMSP Module + if (document.querySelector('input[name="installSVSMSPModule"]').checked) { + appendLog("Installing SVSMSP Module (Priority 1)...", "cyan"); + try { + await fetch('/installSVSMSPModule', { method: 'GET' }); + appendLog("SVSMSP Module installation completed.", "green"); + } catch (error) { + appendLog("Error installing SVSMS", "red"); } - - // Priority 2: Install DattoRMM - if (installDattoRMM.checked) { - const DattoRMMCheckbox = document.querySelectorAll('input[name="dattoRMMOption"]:checked'); - appendLog("Installing selected site RMM (Priority 2)...", "cyan"); - - const checkedValues = Array.from(DattoRMMCheckbox).map(c => c.value); - - const payload = { - checkedValues, // Array of selected checkbox values - UID, // Selected site UID - Name // Selected site name - }; - - fetch('/installrmm', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify(payload) - }) - } - - // Lower-priority tasks - if (setSVSPowerplan.checked) { - fetch('/SetSVSPowerplan', { method: 'GET' }) - } - - if (installCyberQP.checked) { - fetch('/installCyberQP', { method: 'GET' }) - } - - if (installSplashtop.checked) { - fetch('/installSplashtop', { method: 'GET' }) - } - - if (installSVSHelpDesk.checked) { - fetch('/installSVSHelpDesk', { method: 'GET' }) - } - - if (installSVSWatchtower.checked) { - fetch('/installSVSWatchtower', { method: 'GET' }) - } - - if (installThreatLocker.checked) { - fetch('/installThreatLocker', { method: 'GET' }) - } - - if (installRocketCyber.checked) { - fetch('/installRocketCyber', { method: 'GET' }) - } - } + + + // Priority 2: Install DattoRMM + if (document.querySelector('input[name="installDattoRMM"]').checked) { + appendLog("Installing DattoRMM (Priority 2)...", "cyan"); + try { + const DattoRMMCheckbox = document.querySelectorAll('input[name="dattoRMMOption"]:checked'); + const checkedValues = Array.from(DattoRMMCheckbox).map(c => c.value); + + const payload = { + checkedValues, + UID, + Name + }; + + await fetch('/installrmm', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(payload) + }); + appendLog("DattoRMM installation completed.", "green"); + } catch (error) { + appendLog("Error installing DattoRMM: ${error.message}", "red"); + } + } + + + // Priority 3: Other tasks + if (document.querySelector('input[name="setSVSPowerplan"]').checked) { + appendLog("Setting SVS Powerplan (Priority 3)...", "cyan"); + try { + await fetch('/SetSVSPowerplan', { method: 'GET' }); + appendLog("SVS Powerplan set successfully.", "green"); + } catch (error) { + appendLog("Error setting SVS Powerplan: ${error.message}", "red"); + } + } + + if (document.querySelector('input[name="installCyberQP"]').checked) { + appendLog("Installing CyberQP (Priority 3)...", "cyan"); + try { + await fetch('/installCyberQP', { method: 'GET' }); + appendLog("CyberQP installation completed.", "green"); + } catch (error) { + appendLog("Error installing CyberQP: ${error.message}", "red"); + } + } + + if (document.querySelector('input[name="installSplashtop"]').checked) { + appendLog("Installing Splashtop (Priority 3)...", "cyan"); + try { + await fetch('/installSplashtop', { method: 'GET' }); + appendLog("Splashtop installation completed.", "green"); + } catch (error) { + appendLog("Error installing Splashtop: ${error.message}", "red"); + } + } + + if (document.querySelector('input[name="installSVSHelpDesk"]').checked) { + appendLog("Installing SVS HelpDesk (Priority 3)...", "cyan"); + try { + await fetch('/installSVSHelpDesk', { method: 'GET' }); + appendLog("SVS HelpDesk installation completed.", "green"); + } catch (error) { + appendLog("Error installing SVS HelpDesk: ${error.message}", "red"); + } + } + + if (document.querySelector('input[name="installSVSWatchtower"]').checked) { + appendLog("Installing SVS Watchtower (Priority 3)...", "cyan"); + try { + await fetch('/installSVSWatchtower', { method: 'GET' }); + appendLog("SVS Watchtower installation completed.", "green"); + } catch (error) { + appendLog("Error installing SVS Watchtower: ${error.message}", "red"); + } + } + + if (document.querySelector('input[name="installThreatLocker"]').checked) { + appendLog("Installing ThreatLocker (Priority 3)...", "cyan"); + try { + await fetch('/installThreatLocker', { method: 'GET' }); + appendLog("ThreatLocker installation completed.", "green"); + } catch (error) { + appendLog("Error installing ThreatLocker: ${error.message}", "red"); + } + } + + if (document.querySelector('input[name="installRocketCyber"]').checked) { + appendLog("Installing RocketCyber (Priority 3)...", "cyan"); + try { + await fetch('/installRocketCyber', { method: 'GET' }); + appendLog("RocketCyber installation completed.", "green"); + } catch (error) { + appendLog("Error installing RocketCyber: ${error.message}", "red"); + } + } + + })(); + } + + + function endSession() { appendLog("Session ended. Closing application...", "yellow"); fetch('/quit', { method: 'GET' }) @@ -1033,7 +1087,8 @@ try { "/installSVSMSPModule" { if ($request.HttpMethod -eq "GET") { try { - Install-SVSMSP -InstallToolkit + write-host "toolkit would have installed" + #Install-SVSMSP -InstallToolkit $responseString = "Install SVSMSP Module triggered successfully." $response.StatusCode = 200 } catch {