Wednesday, February 29, 2012

Export Farm Solution Package with PowerShell

Follow the steps below to export a farm solution package…

1. Open a text editor – such as Notepad.
2. Paste the following code snippet:

$farm = Get-SPFarm
$file = $farm.Solutions.Item("MySolutionPackage.wsp").SolutionFile

3. Replace the highlighted text above with the name of your solution package.
4. Save the file - give the file a name and save it with the extension ps1 (eg. extract.ps1) and place the file on the C:\ drive.
5. Open the SharePoint 2010 Management Shell
6. Navigate to the location of the script and execute it.
7. The solution package will be available on the C:\ drive

Update: If you want to download all the solutions at once you can use the following script:
$dirName = "C:\Solutions"
foreach ($solution in Get-SPSolution)
$filename = $Solution.SolutionFile.Name

1 comment:

Ramesh Kumar said...

Interesting post! I enjoyed reading it!
Thanks for sharing this useful info.keep updating same way.

Ramesh Roy
Sharepoint Custom Development