added -savesiteonly
This commit is contained in:
@@ -123,7 +123,7 @@
|
||||
|
||||
# ─────────────────────────────────────────────────────────
|
||||
# Fetch only set write sites and exit
|
||||
[Parameter(ParameterSetName='DattoFetch')][switch] $FetchSitesOnly,
|
||||
[Parameter(ParameterSetName='DattoFetch')][switch] $SaveSitesOnly
|
||||
[Parameter(ParameterSetName='DattoFetch')][string] $OutputFile = 'datto_sites.csv',
|
||||
|
||||
# ─────────────────────────────────────────────────────────
|
||||
@@ -1371,6 +1371,8 @@ $script
|
||||
Write-LogHybrid "Fetching site list only…" Info DattoAuth
|
||||
$sites = Get-DattoRmmSites -Password $N8nPassword
|
||||
|
||||
if ($SaveSitesOnly) {
|
||||
# If SaveSitesOnly is true, save the output to a file
|
||||
$ext = [IO.Path]::GetExtension($OutputFile).ToLower()
|
||||
if ($ext -eq '.json') {
|
||||
$sites | ConvertTo-Json -Depth 3 | Out-File -FilePath $OutputFile -Encoding UTF8
|
||||
@@ -1379,9 +1381,14 @@ $script
|
||||
}
|
||||
|
||||
Write-LogHybrid "Wrote $($sites.Count) sites to $OutputFile" Success DattoAuth
|
||||
} else {
|
||||
# If SaveSitesOnly is not true, just fetch sites (for UI purposes or silent mode without saving)
|
||||
Write-LogHybrid "Sites fetched successfully, but not saved." Success DattoAuth
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
# ────────────────────────────────────────────
|
||||
# 3) Invoke the existing Install-DattoRMM cmdlet
|
||||
# ────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user