PowerShell script to download all Farm solutions in SharePoint Farm

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”


2 thoughts on “PowerShell script to download all Farm solutions in SharePoint Farm

  1. 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.


Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Disable feedback surveys in Power Platform

If you have worked in Microsoft 365 PowerApps or Power Automate, you might be familiar with feedback survey which pops up quite often. Microsoft wants your feedback on how likely are your to recommend Power Automate to a friend or colleague? Well, I ran into a conversation in twitter about this survey. Apparently I learnt […]

Read More

Error handling in Azure PowerShell Runbooks

Error handling in Azure PowerShell Runbooks should be handled carefully if not the runbook with continue to Completed state even if there is an Error in the script. Unlike exception, Runbook execution will continue after  an Error  by default. Windows PowerShell has multiple streams of output. Runbooks in Azure work differently in each of these […]

Read More

SharePoint Designer cannot display the item

You run into ‘SharePoint Designer cannot display the item’ error when you are trying to edit an existing workflow setup in Designer quite often when there is a windows update or update to .NET framework installed in your computer. In some cases it may also not allow you to create new workflows. Resolution: Clearing Designer […]

Read More