Sometimes you may need to export all SharePoint 2010/2013 farm solutions as a backup process or to deploy them from staging environment to production environment.
Export Farm Solutions
- Create a backup folder on “C” and give it a meaningful name like “SP2010 Farm Solutions Backup”.
- Open SharePoint 2010 Management Shell
- Change directory or navigate to backup folder
- Enter the following Script to extract all farm solution to current location directory
(Get-SPFarm).Solutions | ForEach-Object{$var = (Get-Location).Path + “\” + $_.Name; $_.SolutionFile.SaveAs($var)} - Go and open the target folder to see all exported solutions
Import Farm Solutions
After copy the folder that contains exported solution on production or target farm server.
- Open SharePoint 2010 Management Shell
- Change directory or navigate to folder that contains all solutions to be deployed
- Enter the following Script to extract all farm solution to current location directoryGet-ChildItem | ForEach-Object{Add-SPSolution -LiteralPath $_.Fullname}
- So all solutions are added to the target farm.
For more information about adding and deploying SP2010 Farm solution, please to open and read Adding and Deploying SharePoint 2010 .WSP Solutions
Same scripts can be used for SharePoint 2013 Farm Solution
I Hope this useful for you,
Thanks.