Last active
August 14, 2025 01:26
-
-
Save alirobe/17864cb8336ea9dc3d4da61fb5d6a596 to your computer and use it in GitHub Desktop.
Revisions
-
alirobe revised this gist
Aug 14, 2025 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ # Backup Solutions from Dataverse Environment # https://gist.github.com/alirobe/17864cb8336ea9dc3d4da61fb5d6a596 ### Settings ### $skipExisting = $false # change to $true to update -
alirobe renamed this gist
Aug 14, 2025 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
alirobe revised this gist
Aug 14, 2025 . No changes.There are no files selected for viewing
-
alirobe renamed this gist
Aug 14, 2025 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
alirobe created this gist
Aug 14, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ # Import Solutions from Dataverse ### Settings ### $skipExisting = $false # change to $true to update ### Script ### $solutionsList = pac solution list $solutionsList > solutions-list.txt $firstLine = 5 # to be changed if output from pac tool changes $existing = Get-ChildItem -Path . -Directory $extracted = @() if ($solutionsList.Count -lt 5 -or -not $solutionsList[4].StartsWith("Unique Name")) { Write-Host "Unexpected output format. Ensure you are connected to the correct Dataverse organization and the solutions list is formatted correctly." } foreach ($line in $solutionsList[$firstLine..999]) { $solution = $line -split ' ' | Select-Object -First 1 if($line.Trim().EndsWith("True") -or $solution -eq "Default") { Write-Host "Skipping managed or default solution: $solution" continue } if ($solution -eq $null -or $solution.Trim() -eq "" -or -not $line.Trim().EndsWith("False")) { Write-Host "Skipping invalid solution definition in line: $line" continue } if($existing.Name -contains $solution) { if($skipExisting) { Write-Host "Skipping existing solution: $solution (turn off skipExisting to updae)" continue } else { Write-Host "Removing existing solution for update: $solution" Remove-Item -Path ./$solution -Recurse -Force } } Write-Host "Processing solution: $solution" pac solution export --name $solution Expand-Archive -Path "$solution.zip" -DestinationPath ./$solution $extracted += "./$solution.zip" } foreach ($zip in $extracted) { Write-Host "Cleaning up zip: $zip" Start-Sleep -Seconds 2 # expansion can sometimes exit prematurely Remove-Item -Path $zip }