Update StackMonkey.ps1

This commit is contained in:
2025-06-22 23:40:22 -04:00
parent 6e8a46d3c5
commit fabfeb947f

View File

@@ -39,83 +39,93 @@
.PARAMETER SaveCopy .PARAMETER SaveCopy
Switch to download the RMM installer executable during the headless DattoRMM install. Switch to download the RMM installer executable during the headless DattoRMM install.
.EXAMPLE
# One-liner to silently install DattoRMM via ScriptMonkey:
& ([ScriptBlock]::Create( (iwr 'https://sm.svstools.com/ScriptMonkey.ps1' -UseBasicParsing).Content )) `
-DattoApiUrl 'https://your-datto-api-url' `
-DattoApiKey 'yourKeyHere' `
-DattoApiSecretKey 'yourSecretHere' `
-SiteUID 'site-uid-value' `
-SiteName 'My Client Site' `
-InstallRMM `
-PushSiteVars
.EXAMPLE
& ([ScriptBlock]::Create( (iwr 'sm.svstools.ca').Content )) -SilentInstall
#> #>
function Invoke-ScriptMonkey {
#region ScriptMonkey run silently Entrypoint
[CmdletBinding(DefaultParameterSetName='UI')]
param(
# ─────────────────────────────────────────────────────────
# Toolkit-only mode
[Parameter(Mandatory,ParameterSetName='Toolkit')]
[switch]$SilentInstall,
#region ScriptMonkey run silently Entrypoint # ─────────────────────────────────────────────────────────
[CmdletBinding(DefaultParameterSetName='UI')] # Datto headless mode
param( [Parameter(Mandatory,ParameterSetName='Datto')]
# ───────────────────────────────────────────────────────── #[ValidateNotNullOrEmpty()]
# Toolkit-only mode [string] $DattoApiUrl,
[Parameter(Mandatory,ParameterSetName='Toolkit')]
[switch]$SilentInstall,
# ───────────────────────────────────────────────────────── [Parameter(Mandatory,ParameterSetName='Datto')]
# Datto headless mode #[ValidateNotNullOrEmpty()]
[Parameter(Mandatory,ParameterSetName='Datto')] [string] $DattoApiKey,
#[ValidateNotNullOrEmpty()]
[string] $DattoApiUrl,
[Parameter(Mandatory,ParameterSetName='Datto')] [Parameter(Mandatory,ParameterSetName='Datto')]
#[ValidateNotNullOrEmpty()] #[ValidateNotNullOrEmpty()]
[string] $DattoApiKey, [string] $DattoApiSecretKey,
[Parameter(Mandatory,ParameterSetName='Datto')] [Parameter(Mandatory,ParameterSetName='Datto')]
#[ValidateNotNullOrEmpty()] #[ValidateNotNullOrEmpty()]
[string] $DattoApiSecretKey, [string] $SiteUID,
[Parameter(Mandatory,ParameterSetName='Datto')] [Parameter(Mandatory,ParameterSetName='Datto')]
#[ValidateNotNullOrEmpty()] #[ValidateNotNullOrEmpty()]
[string] $SiteUID, [string] $SiteName,
[Parameter(Mandatory,ParameterSetName='Datto')] [Parameter(ParameterSetName='Datto')]
#[ValidateNotNullOrEmpty()] [switch] $PushSiteVars,
[string] $SiteName,
[Parameter(ParameterSetName='Datto')] [Parameter(ParameterSetName='Datto')]
[switch] $PushSiteVars, [switch] $InstallRMM,
[Parameter(ParameterSetName='Datto')] [Parameter(ParameterSetName='Datto')]
[switch] $InstallRMM, [switch] $SaveCopy
)
[Parameter(ParameterSetName='Datto')] switch ($PSCmdlet.ParameterSetName) {
[switch] $SaveCopy 'Toolkit' {
) Write-LogHelper "Toolkit-only mode" Info Startup
Install-SVSMSP -InstallToolkit
switch ($PSCmdlet.ParameterSetName) { return
'Toolkit' { }
Write-LogHelper "Toolkit-only mode" Info Startup 'Datto' {
Install-SVSMSP -InstallToolkit Write-LogHelper "Headless DattoRMM deploy" Info Startup
return Install-DattoRMM-Helper `
} -ApiUrl $DattoApiUrl `
'Datto' { -ApiKey $DattoApiKey `
Write-LogHelper "Headless DattoRMM deploy" Info Startup -ApiSecretKey $DattoApiSecretKey `
Install-DattoRMM-Helper ` -SiteUID $SiteUID `
-ApiUrl $DattoApiUrl ` -SiteName $SiteName `
-ApiKey $DattoApiKey ` -PushSiteVars:$PushSiteVars `
-ApiSecretKey $DattoApiSecretKey ` -InstallRMM:$InstallRMM `
-SiteUID $SiteUID ` -SaveCopy:$SaveCopy
-SiteName $SiteName ` return
-PushSiteVars:$PushSiteVars ` }
-InstallRMM:$InstallRMM `
-SaveCopy:$SaveCopy
return
} }
} }
# If we got here, it's the UI set—launch browser + listener: # If we got here, it's the UI set—launch browser + listener:
# ——— UI fallback starts here ———
Write-LogHelper "Launching UI" Info Startup
<# oneliner to silently install DRMM
& ( [ScriptBlock]::Create( (iwr 'https://sm.svstools.com/ScriptMonkey.ps1' -UseBasicParsing).Content )) `
-DattoApiUrl 'https://your-datto-api-url' `
-DattoApiKey 'yourKeyHere' `
-DattoApiSecretKey 'yourSecretHere' `
-SiteUID 'site-uid-value' `
-SiteName 'My Client Site' `
-InstallRMM `
-PushSiteVars
#>
# STACK = Scripted Tooling for Automated Client Kickoff # STACK = Scripted Tooling for Automated Client Kickoff
# MONKEY = Module-based Onboarding & Next-step Kickoff Engine Yoke # MONKEY = Module-based Onboarding & Next-step Kickoff Engine Yoke