Update StackMonkey.ps1

This commit is contained in:
2025-06-24 19:12:40 -04:00
parent 9ac44d482a
commit 03237d691c

View File

@@ -170,10 +170,15 @@ switch ($PSCmdlet.ParameterSetName) {
if (-not $creds) { if (-not $creds) {
throw "Failed to retrieve Datto API credentials from n8n" throw "Failed to retrieve Datto API credentials from n8n"
} }
# overwrite the parameters with what we just fetched
$DattoApiUrl = $creds.ApiUrl # 1) Fetch creds
$DattoApiKey = $creds.ApiKey $creds = Get-DattoApiCredentials -Password $N8nPassword
$DattoApiSecretKey = $creds.ApiSecretKey if (-not $creds) { throw "Could not fetch creds" }
# 2) Store in globals for everyone else
$Global:ApiUrl = $resp.ApiUrl
$Global:ApiKey = $resp.ApiKey
$Global:ApiSecretKey = $resp.ApiSecretKey
Write-LogHelper "Fetched Datto API credentials from n8n" Success DattoAuth Write-LogHelper "Fetched Datto API credentials from n8n" Success DattoAuth
} }
@@ -186,9 +191,9 @@ switch ($PSCmdlet.ParameterSetName) {
# 2) Invoke the existing Install-DattoRMM cmdlet # 2) Invoke the existing Install-DattoRMM cmdlet
# ──────────────────────────────────────────── # ────────────────────────────────────────────
Install-DattoRMM ` Install-DattoRMM `
-ApiUrl $DattoApiUrl ` -ApiUrl $Global:ApiUrl `
-ApiKey $DattoApiKey ` -ApiKey $Global:ApiKey `
-ApiSecretKey $DattoApiSecretKey ` -ApiSecretKey $Global:ApiSecretKey `
-SiteUID $SiteUID ` -SiteUID $SiteUID `
-SiteName $SiteName ` -SiteName $SiteName `
-PushSiteVars:$PushSiteVars ` -PushSiteVars:$PushSiteVars `