change required password by script it will be up to banana to ask

This commit is contained in:
2025-12-17 19:15:31 -05:00
parent ca31f86811
commit 99bacdd7b4

View File

@@ -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