Last active
October 24, 2019 14:58
-
-
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
This file contains 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 characters
# 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