Skip to content

Instantly share code, notes, and snippets.

@hansgafriedzal
Created June 10, 2020 04:11
Show Gist options
  • Save hansgafriedzal/0666564f37a2550e0f030fcbbfd91d7c to your computer and use it in GitHub Desktop.
Save hansgafriedzal/0666564f37a2550e0f030fcbbfd91d7c to your computer and use it in GitHub Desktop.
function Export-All-XSPSolution ($Location)
{
$farm = Get-SPFarm
If (test-path $Location) {} Else {mkdir $Location}
Write-Host "Downloading..."
$farm.Solutions
foreach($solution in $farm.Solutions){
$solution = $farm.Solutions[$solution.Name]
$file = $solution.SolutionFile
$file.SaveAs($Location + ‘\’ + $solution.Name)
}
Write-Host "All the solutions are downloaded to $Location"
}
$timestamp = Get-Date -format "yyyyMMddHHmmss"
$path = "D:\BackupWsp\$timestamp"
Export-All-XSPSolution -Location $path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment