From 99bacdd7b4f26d60511ef0655e2999c9dc229295 Mon Sep 17 00:00:00 2001 From: Stephan Yelle Date: Wed, 17 Dec 2025 19:15:31 -0500 Subject: [PATCH] change required password by script it will be up to banana to ask --- samy.ps1 | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/samy.ps1 b/samy.ps1 index 9c010fa..3fb2cab 100644 --- a/samy.ps1 +++ b/samy.ps1 @@ -231,6 +231,7 @@ $ConfirmPreference = 'None' [Parameter(Mandatory,ParameterSetName='DattoFetch')] [Parameter(Mandatory,ParameterSetName='DattoInstall')] + [AllowEmptyString()] [String]$WebhookPassword, [string]$WebhookUrl = $Global:DattoWebhookUrl, @@ -2680,22 +2681,27 @@ function Install-DattoRMM { # 1) Optionally fetch credentials from webhook if ($UseWebhook) { - if (-not $WebhookPassword) { - Write-LogHybrid "Webhook password missing." Error DattoRMM -LogToEvent; return - } try { + $whHeaders = @{} + if (-not [string]::IsNullOrEmpty($WebhookPassword)) { + $whHeaders.SAMYPW = $WebhookPassword + } + $resp = Invoke-RestMethod -Uri $WebhookUrl ` - -Headers @{ SAMYPW = $WebhookPassword } ` - -Method GET + -Headers $whHeaders ` + -Method GET + $ApiUrl = $resp.ApiUrl $ApiKey = $resp.ApiKey $ApiSecretKey = $resp.ApiSecretKey Write-LogHybrid "Webhook credentials fetched." Success DattoRMM -LogToEvent } catch { - Write-LogHybrid "Failed to fetch webhook credentials: $($_.Exception.Message)" Error DattoRMM -LogToEvent; return + Write-LogHybrid "Failed to fetch webhook credentials: $($_.Exception.Message)" Error DattoRMM -LogToEvent + return } } + # 2) Validate API parameters if (-not $ApiUrl -or -not $ApiKey -or -not $ApiSecretKey) { Write-LogHybrid "Missing required API parameters." Error DattoRMM -LogToEvent; return