SharePoint OnPremises – PowerShell script to download farm solutions – .wsp files – requires while migration

Hi All,

Greetings for the day 🙂 LIFE IS BEAUTIFUL 🙂

Background : Recently got a chance to work on migration. I am newbie to migration since long time I was working on M365. We have to migrate SharePoint 2010 web applications to SharePoint 2016. So our first step is to migrate SharePoint 2010 to SharePoint 2013.

We need to deploy all our custom SharePoint 2010 farm solutions to SharePoint 2013 environment. So we need to download all custom farm solutions, copy to SharePoint 2013 environment and deploy.

There is no way available from UI (Central Admin) to download our custom farm solutions. Hence the PowerShell script comes to the picture. Sharing here PowerShell script. SHARING IS CARING 🙂

PowerShell script to download Farm solution :

  • Get the farm
$farm = Get-SPFarm
  • Once we have farm object available, we have “Solutions” property which contains all the solutions
  • We will iterate through the solution and save them on specified location
  • Here we will save them at current location, by getting current location using “Get-Location” as
#Get Current location
$currentLocation=Get-Location
  • Iterate through each solution and save them at current location
 Foreach($solution in $farm.Solutions)
      {
         Try
          {
                Write-Host "solution - $($solution.Name)"
                $solutionName= $solution.SolutionFile.Name
                $solutionlocation=$currentLocation.Path + "\" + $solutionName
                $solution.SolutionFile.SaveAs($solutionlocation)
          }
          Catch
          {
                Write-Host "Exception while fetching the solution " 
                $solution " - " $_.Exception.Message -f Red
          }#catch
        }#Foreach

Complete Script :

Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue

#get the farm
$farm = Get-SPFarm

#Get Current location
$currentLocation=Get-Location

#Iterate through each solution and save them at current location
Foreach($solution in $farm.Solutions)
      {
         Try
          {
                Write-Host "solution $($solution.Name)"
                $solutionName= $solution.SolutionFile.Name
                $solutionlocation=$currentLocation.Path + "\" + $solutionName
                $solution.SolutionFile.SaveAs($solutionlocation)
          }
          Catch
          {
                Write-Host "Exception while fetching the solution " 
                $solution " - " $_.Exception.Message -f Red
          }#catch
        }#Foreach

Thanks for reading 🙂 If its worth at least reading once, kindly please like and share 🙂 SHARE ING IS CARING  🙂

Share In Teams:

Enjoy the beautiful life 🙂 Have a FUN 🙂 HAVE A SAFE LIFE 🙂 TAKE CARE 🙂

Prasham Sabadra

LIFE IS VERY BEAUTIFUL :) ENJOY THE WHOLE JOURNEY :) Founder of Knowledge Junction and live-beautiful-life.com, Author, Learner, Passionate Techie, avid reader. Certified Professional Workshop Facilitator / Public Speaker. Scrum Foundation Professional certificated. Motivational, Behavioral , Technical speaker. Speaks in various events including SharePoint Saturdays, Boot camps, Collages / Schools, local chapter. Can reach me for Microsoft 365, Azure, DevOps, SharePoint, Teams, Power Platform, JavaScript.

You may also like...

1 Response

  1. July 2, 2021

    […] Recently I have an article to download all SharePoint farm solution in SharePoint 2010 environment – SharePoint OnPremises – PowerShell script to download farm solutions – .wsp files – requires w… […]

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

%d bloggers like this: