When we deploy an updated version of a solution package, it’s better to take a backup of the currently deployed version. Although we can build the appropriate version from the version controlling system if there any, it’s always safer to get the current working solution package which is proven working in that environment.
Following script extracts a set of solution packages you wish to download from the farm.
- $packages = @("solution1.wsp","solution2.wsp")
- $solutionPath = "C:\Backup\"
- foreach ($solution in (Get-SPFarm).Solutions)
- {
- if($packages -contains $solution.Name)
- {
- $filename = $Solution.SolutionFile.Name
- $solution.SolutionFile.SaveAs($solutionPath + $filename)
- }
- }