change save path
This commit is contained in:
@@ -1372,7 +1372,10 @@ $script
|
|||||||
$sites = Get-DattoRmmSites -Password $N8nPassword
|
$sites = Get-DattoRmmSites -Password $N8nPassword
|
||||||
|
|
||||||
if ($SaveSitesOnly) {
|
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()
|
$ext = [IO.Path]::GetExtension($OutputFile).ToLower()
|
||||||
if ($ext -eq '.json') {
|
if ($ext -eq '.json') {
|
||||||
$sites | ConvertTo-Json -Depth 3 | Out-File -FilePath $OutputFile -Encoding UTF8
|
$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
|
Write-LogHybrid "Wrote $($sites.Count) sites to $OutputFile" Success DattoAuth
|
||||||
|
# Open the folder containing the file
|
||||||
|
Start-Process explorer.exe /select,"$filePath"
|
||||||
} else {
|
} else {
|
||||||
# If SaveSitesOnly is not true, just fetch sites (for UI purposes or silent mode without saving)
|
# 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
|
Write-LogHybrid "Sites fetched successfully, but not saved." Success DattoAuth
|
||||||
|
|||||||
Reference in New Issue
Block a user