Export All Custom Solutions from SharePoint Farm

When I’m in process of cloning of production environment to test environment. I’ve come across nice trick to export all wsp files from your SharePoint farm.

It is done by PowerShell script and I will list all steps required below:

  • Run Windows PowerShell
  • Load SharePoint snap in to PowerShell: [System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”)
  • Get the actual Farm into variable: $cf = [Microsoft.SharePoint.Administration.SPFarm]::Local
  • Check whether SharePoint Farm variable loaded: $cf


  • Get all solutions of the farm into a farm variable: $sols = $cf.Solutions
  • Check solutions variable: $sols
  • Export solutions variable into temp folder: $sols | ForEach-Object {Write-Host $_.name -foregroundcolor yellow; $_.SolutionFile.SaveAs(“c:\temp\wsp\” + $_.name)}


  • Now, all of your custom solutions will be in C:\temp\wsp folder

Tagged: , ,

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: