fixed the onboarding checkboxes

This commit is contained in:
2025-05-29 00:31:05 -04:00
parent b42828e946
commit 520aae8fb4

View File

@@ -30,13 +30,13 @@ $Port = 8082
$Global:Tasks = @( $Global:Tasks = @(
# On-Boarding, left column # On-Boarding, left column
@{ Id='setSVSPowerplan'; Name='setSVSPowerplan'; Label='Set SVS Powerplan'; HandlerFn='Handle-setSVSPowerPlan'; Page='onboard'; Column='left' }, @{ Id='setSVSPowerplan'; Name='setSVSPowerplan'; Label='Set SVS Powerplan'; HandlerFn='Handle-setSVSPowerPlan'; Page='onboard'; Column='left' },
@{ Id='installSVSMSPModule'; Name='installSVSMSPModule'; Label='Install SVSMSP Module'; HandlerFn='Handle-InstallSVSMSP'; Page='onboard'; Column='left' }, @{ Id='installSVSMSPModule'; Name='installSVSMSPModule'; Label='Install SVSMSP Module'; HandlerFn='Handle-InstallSVSMSP'; Page='onboard'; Column='left' },
@{ Id='installCyberQP'; Name='installCyberQP'; Label='Install CyberQP'; HandlerFn='Handle-InstallCyberQP'; Page='onboard'; Column='left' }, @{ Id='installCyberQP'; Name='installCyberQP'; Label='Install CyberQP'; HandlerFn='Handle-InstallCyberQP'; Page='onboard'; Column='left' },
@{ Id='installSVSHelpDesk'; Name='installSVSHelpDesk'; Label='Install SVS HelpDesk'; HandlerFn='Install-SVSHelpDesk'; Page='onboard'; Column='left' }, @{ Id='installSVSHelpDesk'; Name='installSVSHelpDesk'; Label='Install SVS HelpDesk'; HandlerFn='Handle-InstallSVSHelpDesk'; Page='onboard'; Column='left' },
@{ Id='installThreatLocker'; Name='installThreatLocker'; Label='Install ThreatLocker'; HandlerFn='Install-ThreatLocker'; Page='onboard'; Column='left' }, @{ Id='installThreatLocker'; Name='installThreatLocker'; Label='Install ThreatLocker'; HandlerFn='Handle-InstallThreatLocker'; Page='onboard'; Column='left' },
@{ Id='installRocketCyber'; Name='installRocketCyber'; Label='Install RocketCyber'; HandlerFn='Install-RocketCyber'; Page='onboard'; Column='left' }, @{ Id='installRocketCyber'; Name='installRocketCyber'; Label='Install RocketCyber'; HandlerFn='Handle-InstallRocketCyber'; Page='onboard'; Column='left' },
@{ Id='installDattoRMM'; Name='installDattoRMM'; Label='Install DattoRMM'; HandlerFn='Handle-InstallRMM'; Page='onboard'; Column='left'; @{ Id='installDattoRMM'; Name='installDattoRMM'; Label='Install DattoRMM'; HandlerFn='Handle-InstallDattoRMM'; Page='onboard'; Column='left';
SubOptions= @( SubOptions= @(
@{ Value='inputVar'; Label='Copy Site Variables' }, @{ Value='inputVar'; Label='Copy Site Variables' },
@{ Value='rmm'; Label='Install RMM Agent' }, @{ Value='rmm'; Label='Install RMM Agent' },
@@ -380,7 +380,98 @@ function Handle-InstallCyberQP {
Respond-Text $Context "CyberQP installed" Respond-Text $Context "CyberQP installed"
} }
function Handle-InstallThreatLocker {
param($Context)
# 1) call into your module
Install-ThreatLocker
# 2) log & write back a simple text response
Write-LogHybrid "ThreatLocker installed" "Success" "OnBoard"
Respond-Text $Context "ThreatLocker installed"
}
function Handle-InstallRocketCyber {
param($Context)
# 1) call into your module
Install-RocketCyber
# 2) log & write back a simple text response
Write-LogHybrid "RocketCyber installed" "Success" "OnBoard"
Respond-Text $Context "RocketCyber installed"
}
function Handle-InstallSVSHelpDesk {
param($Context)
# 1) call into your module
Install-SVSHelpDesk
# 2) log & write back a simple text response
Write-LogHybrid "SVS HelpDesk installed" "Success" "OnBoard"
Respond-Text $Context "SVS HelpDesk installed"
}
function Handle-InstallDattoRMM {
param($Context)
$request = $Context.Request
$response = $Context.Response
if ($request.HttpMethod -ne "POST") {
$response.StatusCode = 405
$response.ContentType = "text/plain"
$response.OutputStream.Write(
[Text.Encoding]::UTF8.GetBytes("Method not allowed. Use POST."),
0, 29
)
$response.OutputStream.Close()
return
}
try {
$body = (New-Object IO.StreamReader $request.InputStream).ReadToEnd()
$requestData = $body | ConvertFrom-Json
$checked = $requestData.checkedValues
$UID = $requestData.UID
$Name = $requestData.Name
if (-not $checked -or -not $UID -or -not $Name) {
throw "Missing required parameters"
}
# Build the command
$cmd = "Install-DattoRMM -ApiUrl '$ApiUrl' -ApiKey '$ApiKey' -ApiSecretKey '$ApiSecretKey' -SiteName '$Name' -SiteUID '$UID'"
if ($checked -contains 'inputVar') { $cmd += " -PushSiteVars" }
if ($checked -contains 'rmm') { $cmd += " -InstallRMM" }
if ($checked -contains 'exe') { $cmd += " -SaveCopy" }
# Invoke and respond
try {
Invoke-Expression $cmd
Write-LogHybrid "RMM install triggered for $Name" "Success" "DattoRMM"
$response.StatusCode = 200
$responseString = "RMM installation triggered successfully for $Name."
} catch {
Write-LogHybrid "Error triggering RMM install: $_" "Error" "DattoRMM"
$response.StatusCode = 500
$responseString = "Error triggering RMM install: $_"
}
}
catch {
Write-LogHybrid "Bad request to /installDattoRMM: $_" "Error" "DattoRMM"
$response.StatusCode = 400
$responseString = "Error: $($_.Exception.Message)"
}
# write the response
$bytes = [Text.Encoding]::UTF8.GetBytes($responseString)
$response.ContentType = "text/plain"
$response.ContentLength64 = $bytes.Length
$response.OutputStream.Write($bytes, 0, $bytes.Length)
$response.OutputStream.Close()
}
# Off-boarding handlers # Off-boarding handlers
function Uninstall-CyberQP { function Uninstall-CyberQP {