Recently when i was preparing a SharePoint Farm for upgrade which has lot of custom and 3rd party farm solutions, I have to download or some how gather all those .wsp files to move to new server farm. I had rough time gathering all the wsp’s until i stumble upon this script which download all farm solutions in a SharePoint farm to a location or file drive you specify. It saved a lot of time for me. It is a handy script to have while performing upgrades/migrations.
#PowerShell script to download all Farm solutions in a SharePoint farm
#Get reference to SharePoint farm
$farm = Get-SPFarm
#Location to save the solution files
$loc = “D:\solutions” #replace with your file location. Make sure that the folder is already created/existing
#Download all the solutions
foreach($solution in $farm.Solutions){
$solution = $farm.Solutions[$solution.Name]
$file = $solution.SolutionFile
$file.SaveAs($loc + ‘\’ + $solution.Name)
}
Write-Host “All the solutions are downloaded to $loc”
Hi Bharath,
Thanks for the script.
There are a cupple of things:
1. You can completely remove the line …
$solution = $farm.Solutions[$solution.Name]
… and it will still work as it does.
2. There is a typo in the line …
$file.SaveAs($savedir + ‘\’ + $solution.Name)
… Instead of $savedir, it should be $loc.
But, again, thank you very much for the script. It’s usefull.
Regards,
Sergio
Corrected the typo. Thanks for pointing Sergio.