Using Powershell to export & import farm solutions

Here is a handy script that will export all farm solution .wsp and .cab files at once:

[sourcecode language=”powershell”]
Add-PSSnapin Microsoft.SharePoint.PowerShell
$farm = Get-SPFarm
$farm.Solutions | ForEach-Object{$_.SolutionFile.SaveAs(“c:\export\” + $}

Once you have moved the solutions to another machine, you can use the following script to add the solutions to the new farm:

Add-PSSnapin Microsoft.SharePoint.PowerShell
$files = Get-ChildItem “c:\install\”
ForEach ($file in $files) {Add-SPSolution $file.FullName}

Leave a Reply

Your email address will not be published. Required fields are marked *

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

%d bloggers like this: