Update samy.ps1

This commit is contained in:
2025-12-20 12:31:04 -05:00
parent e7d521a107
commit 8877625054

View File

@@ -2046,22 +2046,30 @@ function Install-DattoRMM {
# 1) Optionally fetch credentials from webhook
if ($UseWebhook) {
if (-not $WebhookPassword) {
Write-LogHybrid "Webhook password missing." Error DattoRMM -LogToEvent; return
}
# Allow blank for IP allowlist scenario. Only treat true $null as missing.
if ($null -eq $WebhookPassword) { $WebhookPassword = '' }
Write-LogHybrid "Webhook password not provided (null). Treating as blank for allowlisted IP flow." Warning DattoRMM -LogToEvent
try {
$resp = Invoke-RestMethod -Uri $WebhookUrl `
-Headers @{ SAMYPW = $WebhookPassword } `
-Method GET
-Headers @{ SAMYPW = [string]$WebhookPassword } `
-Method GET `
-ErrorAction Stop
$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
}
catch {
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