change required password by script it will be up to banana to ask
This commit is contained in:
18
samy.ps1
18
samy.ps1
@@ -231,6 +231,7 @@ $ConfirmPreference = 'None'
|
|||||||
|
|
||||||
[Parameter(Mandatory,ParameterSetName='DattoFetch')]
|
[Parameter(Mandatory,ParameterSetName='DattoFetch')]
|
||||||
[Parameter(Mandatory,ParameterSetName='DattoInstall')]
|
[Parameter(Mandatory,ParameterSetName='DattoInstall')]
|
||||||
|
[AllowEmptyString()]
|
||||||
[String]$WebhookPassword,
|
[String]$WebhookPassword,
|
||||||
|
|
||||||
[string]$WebhookUrl = $Global:DattoWebhookUrl,
|
[string]$WebhookUrl = $Global:DattoWebhookUrl,
|
||||||
@@ -2680,22 +2681,27 @@ function Install-DattoRMM {
|
|||||||
|
|
||||||
# 1) Optionally fetch credentials from webhook
|
# 1) Optionally fetch credentials from webhook
|
||||||
if ($UseWebhook) {
|
if ($UseWebhook) {
|
||||||
if (-not $WebhookPassword) {
|
|
||||||
Write-LogHybrid "Webhook password missing." Error DattoRMM -LogToEvent; return
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
|
$whHeaders = @{}
|
||||||
|
if (-not [string]::IsNullOrEmpty($WebhookPassword)) {
|
||||||
|
$whHeaders.SAMYPW = $WebhookPassword
|
||||||
|
}
|
||||||
|
|
||||||
$resp = Invoke-RestMethod -Uri $WebhookUrl `
|
$resp = Invoke-RestMethod -Uri $WebhookUrl `
|
||||||
-Headers @{ SAMYPW = $WebhookPassword } `
|
-Headers $whHeaders `
|
||||||
-Method GET
|
-Method GET
|
||||||
|
|
||||||
$ApiUrl = $resp.ApiUrl
|
$ApiUrl = $resp.ApiUrl
|
||||||
$ApiKey = $resp.ApiKey
|
$ApiKey = $resp.ApiKey
|
||||||
$ApiSecretKey = $resp.ApiSecretKey
|
$ApiSecretKey = $resp.ApiSecretKey
|
||||||
Write-LogHybrid "Webhook credentials fetched." Success DattoRMM -LogToEvent
|
Write-LogHybrid "Webhook credentials fetched." Success DattoRMM -LogToEvent
|
||||||
} catch {
|
} 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
|
# 2) Validate API parameters
|
||||||
if (-not $ApiUrl -or -not $ApiKey -or -not $ApiSecretKey) {
|
if (-not $ApiUrl -or -not $ApiKey -or -not $ApiSecretKey) {
|
||||||
Write-LogHybrid "Missing required API parameters." Error DattoRMM -LogToEvent; return
|
Write-LogHybrid "Missing required API parameters." Error DattoRMM -LogToEvent; return
|
||||||
|
|||||||
Reference in New Issue
Block a user