Update samy.ps1
This commit is contained in:
22
samy.ps1
22
samy.ps1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user