Export MOSS 2007 feature to *.wsp file

Scenario:
You need to extract an existing feature from MOSS 2007 into a *.wsp file to install it on another server (for example)

PowerShell script:

[System.Reflection.Assembly]::Load(“Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”)
[System.Reflection.Assembly]::Load(“Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”)
$farm = [microsoft.sharepoint.administration.spfarm]::Local
$feature = "solutionname.wsp"
$wsp = $farm.Solutions.Item($feature.SolutionFile)
$wsp.SaveAs("c:\$feature")

Note:
If you need to install PowerShell (Installation does not require a restart) you can download it from here: http://support.microsoft.com/kb/968930

Props:
The solution originally provided here: extract wsp file from configuration database

Leave a Reply