MOSS / SharePoint 2007 – PowerShell script to download all farm solutions – requires while migration

PowerShell script to downloas MOSS farm solutions
PowerShell script to downloas MOSS farm solutions

Hi All,

Greetings for the day 🙂 LIFE IS BEAUTIFUL 🙂

SharePoint migration continues. Today new issue and solution.

Background :

  • 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 while migration
  • Now we have migration project from SharePoint 2007 / Moss to SharePoint 2016
  • So one of the step is deploying our custom farm solution in SharePoint 2010 environment
  • To execute above step we need to download all the farm solutions in MOSS environment
  • We already have PowerShell script but it didnt worked completly in MOSS environment
  • We need to do bit change in PowerShell script and hence this article 🙂

PowerShell script to download custom farm solutions from MOSS / SharePoint 2007 environment :

  • Load SharePoint assembly
[System.Reflection.Assembly]::Load("Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c")

  • Get the farm object
#Get Farm object
[Microsoft.SharePoint.Administration.SPFarm]$farm = [Microsoft.SharePoint.Administration.SPFarm]::get_Local()

  • set the directory where we need to download the farm solutions
$solDirName = "d:\MOSS Farm Solutions"

  • Loop through each solution using “Solutions” property of “Farm” object => Farm.Solutions
  • Get the name of solution
  • Save the solution on file system as
foreach ($solution in $farm.Solutions)
{   
    Write-Host "Downloading solution $($Solution.Name)"
    $solutionName= $Solution.SolutionFile.Name
    $solution.SolutionFile.SaveAs("$solDirName\$solutionName")
}  

Complete Script :

[System.Reflection.Assembly]::Load("Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c")

#Get Farm object
[Microsoft.SharePoint.Administration.SPFarm]$farm = [Microsoft.SharePoint.Administration.SPFarm]::get_Local()

$solDirName = "d:\MOSS Farm Solutions"

foreach ($solution in $farm.Solutions)
{   
    Write-Host "Downloading solution $($Solution.Name)"
    $solutionName= $Solution.SolutionFile.Name
    $solution.SolutionFile.SaveAs("$solDirName\$solutionName")
}  

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

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

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

%d bloggers like this: