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 ๐
2 Responses
[…] 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… […]
[…] SharePoint OnPremises โ PowerShell script to download farm solutions โ .wsp files โ requires w… and […]
You must log in to post a comment.