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

1 Response

Leave a Reply

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