Monday, April 23, 2018

Export / import all solutions in SharePoint farm using PowerShell


Export Farm Solutions
  1. Create a backup folder on your disk and give it a meaningful name like “SP Farm Solutions Backup”.
  1. Open SharePoint Management Shell            
  2. Change directory or navigate to backup folder 
  1. 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)}

  1. 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.
  1. Open SharePoint Management Shell
  2. Change directory or navigate to folder that contains all solutions to be deployed
  3. Enter the following Script to extract all farm solution to current location directory


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


  1. So all solutions are added to the target farm.


Install Farm Solution

If you install solution on Web application

Install-SPSolution -Identity SolutionName.wsp -WebApplication http://WebAppName -GACDeployment -CompatibilityLevel {15}

         or if you install it on Farm

Install-SPSolution -Identity SolutionName.wsp -GACDeployment -CompatibilityLevel {15}

More information about Install-SPSolution you can find on this link.

No comments:

Post a Comment