change required password by script it will be up to banana to ask
This commit is contained in:
16
samy.ps1
16
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 } `
|
||||
-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
|
||||
|
||||
Reference in New Issue
Block a user