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