Exporting solutions between farms

Requirement

Export all solutions from one farm and deploy it to another farm.

Solution

Using Windows Powershell, run the following commands:

Export farm solutions

(Get-SPFarm).Solutions | ForEach-Object{$var = (Get-Location).Path + “\” + $_.Name; $_.SolutionFile.SaveAs($var)}

This will export all solutions in the farm to the path “\”. Solutions were exported to C:\ as *.wsp files.

You can either choose to copy the *.wsp files and import your solution manually using the following commands:

  • Add-SPSolution <path to wsp file>
  • Install-SPSolution <solution guid> -gacdeployment -webapplication <url>

Or, you may import all your solutions automatically by running the following command.

Import your solutions

Get-ChildItem | ForEach-Object{Add-SPSolution -LiteralPath $_.Fullname}

Deploy your solutions

Get-SPSolution | ForEach-Object {If ($_.ContainsWebApplicationResource -eq $False) {Install-SPSolution -Identity $_ -GACDeployment} else {Install-SPSolution -Identity $_ -AllWebApplications -GACDeployment}}

See Shane’s blog for more information:

 

Tags:

No comments yet.

Leave a Reply

%d bloggers like this: