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

2 Responses

  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… […]

  2. February 24, 2022

    […] SharePoint OnPremises โ€“ PowerShell script to download farm solutions โ€“ .wsp files โ€“ requires w… and […]

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

%d bloggers like this: