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 Microsoft 365 Junction, Speaker, Author, Learner, Developer, Passionate Techie. Certified Professional Workshop Facilitator / Public Speaker. Believe in knowledge sharing. Around 20+ years of total IT experience and 17+ years of experience in SharePoint and Microsoft 365 services Please feel free me to contact for any SharePoint / Microsoft 365 queries. I am also very much interested in behavioral (life changing) sessions like motivational speeches, Success, Goal Setting, About Life, How to live Life etc. My book - Microsoft 365 Power Shell hand book for Administrators and Beginners and 100 Power Shell Interview Questions - https://www.amazon.in/Microsoft-Administrators-Beginners-Interview-Questions/dp/9394901639/ref=tmm_pap_swatch_0?_encoding=UTF8&qid=1679029081&sr=8-11

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

Leave a Reply

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

Discover more from Microsoft 365

Subscribe now to keep reading and get access to the full archive.

Continue reading