Update samy.ps1
This commit is contained in:
26
samy.ps1
26
samy.ps1
@@ -2693,9 +2693,17 @@ function Install-DattoRMM {
|
||||
$whHeaders.SAMYPW = $WebhookPassword
|
||||
}
|
||||
|
||||
$resp = Invoke-RestMethod -Uri $WebhookUrl `
|
||||
-Headers $whHeaders `
|
||||
-Method GET
|
||||
$irmParams = @{
|
||||
Uri = $WebhookUrl
|
||||
Method = 'Get'
|
||||
ErrorAction = 'Stop'
|
||||
ContentType = 'application/json'
|
||||
}
|
||||
|
||||
if ($whHeaders.Count -gt 0) { $irmParams.Headers = $whHeaders }
|
||||
|
||||
$resp = Invoke-RestMethod @irmParams
|
||||
|
||||
|
||||
$ApiUrl = $resp.ApiUrl
|
||||
$ApiKey = $resp.ApiKey
|
||||
@@ -2734,7 +2742,17 @@ function Install-DattoRMM {
|
||||
# 4) Fetch site list only
|
||||
if ($FetchSites) {
|
||||
try {
|
||||
$sitesResp = Invoke-RestMethod -Uri "$ApiUrl/api/v2/account/sites" -Method Get -Headers $headers
|
||||
$irmParams = @{
|
||||
Uri = "$ApiUrl/api/v2/account/sites"
|
||||
Method = 'Get'
|
||||
ErrorAction = 'Stop'
|
||||
ContentType = 'application/json'
|
||||
}
|
||||
|
||||
if ($headers.Count -gt 0) { $irmParams.Headers = $headers }
|
||||
|
||||
$sitesResp = Invoke-RestMethod @irmParams
|
||||
|
||||
$siteList = $sitesResp.sites | Sort-Object name | ForEach-Object {
|
||||
[PSCustomObject]@{ Name = $_.name; UID = $_.uid }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user