PowerShell script to download all Farm solutions

MSTechTalk PowerShell

Some time we got requirement to download farm solutions and it is specially required in migrations. Below I am sharing a simple PowerShell script which can download all solutions deployed on the SharePoint Farm. You need to execute  this script on SharePoint Farm with SPFarm account as this script need SharePoint Farm administrative access to execute.


function DownloadAllFarmSolutions()
#Get reference to SharePoint farm
$farm = [Microsoft.SharePoint.Administration.SPFarm]::get_Local()

#Path to save the solution files, Create the folder before executing script
$path = “C:\SPSolutions”

#Download all the farm solutions

foreach($spSolution in $farm.Solutions){

$spSolution = $farm.Solutions[$spSolution.Name]
$file = $solution.SolutionFile
$file.SaveAs($path + ‘\’ + $spSolution.Name)

Execute the script on PowerShell and then call the function DownloadAllFarmSolutions which will save Farm solutions on specified path.

This script has been tested on SharePoint 2010, SharePoint 2013 and SharePoint 2016.

The following two tabs change content below.
Adnan Amin
Adnan is an active SharePoint MVP and having over 11 years of extensive experience with major expertise on SharePoint Server, office 365, .Net Platform and Microsoft BI, Adnan is currently working as SharePoint Architect at FMT Consultants. He is MCT Regional Lead for Pakistan Chapter since 2012. He is working on SharePoint for past seven years and worked on different intranet/intranet solutions for private & govt. sector majorly in United States and Gulf region, which include OOB and customized solutions. He is a trainer, technology evangelist and also speaks in community forums.

Leave a Reply

Your email address will not be published. Required fields are marked *