Using Powershell to export & import farm solutions

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

Add-PSSnapin Microsoft.SharePoint.PowerShell
$farm = Get-SPFarm
$farm.Solutions | ForEach-Object{$_.SolutionFile.SaveAs("c:\export\" + $_.SolutionFile.name)}</p>
Once you have moved the solutions to another machine, you can use the following script to add the solutions to the new farm:
<p style="padding-left: 30px;">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 *