change save path

This commit is contained in:
2025-06-30 00:02:17 -04:00
parent 78c539e629
commit 0b049c8be5

View File

@@ -1372,7 +1372,10 @@ $script
$sites = Get-DattoRmmSites -Password $N8nPassword
if ($SaveSitesOnly) {
# If SaveSitesOnly is true, save the output to a file
# If SaveSitesOnly is true, save the output to a file on desktop
$desktopPath = [System.Environment]::GetFolderPath('Desktop')
$filePath = Join-Path -Path $desktopPath -ChildPath $OutputFile
$ext = [IO.Path]::GetExtension($OutputFile).ToLower()
if ($ext -eq '.json') {
$sites | ConvertTo-Json -Depth 3 | Out-File -FilePath $OutputFile -Encoding UTF8
@@ -1381,6 +1384,8 @@ $script
}
Write-LogHybrid "Wrote $($sites.Count) sites to $OutputFile" Success DattoAuth
# Open the folder containing the file
Start-Process explorer.exe /select,"$filePath"
} 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