Skip to content

Instantly share code, notes, and snippets.

@jcallaghan
Last active October 24, 2019 14:58
Show Gist options
  • Save jcallaghan/590647ba16a1d455ea6ba9b3424cbb9e to your computer and use it in GitHub Desktop.
Save jcallaghan/590647ba16a1d455ea6ba9b3424cbb9e to your computer and use it in GitHub Desktop.
Download and backup deployed SharePoint solutions from the config database. See https://jcallaghan.com/2011/09/backup-and-download-solutions-in-sharepoint-from-the-configuration-database/ for more information. #Website
# Download and backup deployed SharePoint solutions from the config database
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$dir = "C:\Solutions\"
$solutions = Get-SPSolution
if(!$solutions){
write-host "No solutions found." -foregroundcolor Red
}else{
New-Item -ItemType directory -Path $dir -force | Out-Null
write-host "Saving solutions to $($dir)."
foreach($wsp in Get-SPSolution){
$name = $wsp.SolutionFile.Name
$wsp.SolutionFile.SaveAs("$dir\$name")
write-host "Solution '$($name)' saved."
}
write-host "All solutions have been saved successfully." -foregroundcolor green
ii $dir
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment