Extract and Download All Installed Farm Solution Packages (WSP Files) in SharePoint

There were many solution packages installed in my current SharePoint environment. During a server replacement, we noticed that the WSP file for a particular solution is missing in TFS! (Our version control repository!)

To extract and download all installed solution WSP files, use these PowerShell scripts:

Export all Farm Solutions (WSP) from central admin with PowerShell in SharePoint:

$dirName = "c:\Solutions"
foreach ($solution in Get-SPSolution)
{
    $id = $Solution.SolutionID
    $title = $Solution.Name
    $filename = $Solution.SolutionFile.Name
    $solution.SolutionFile.SaveAs("$dirName\$filename")
}

Download farm solution WSP in SharePoint 2013

If you want to download a particular solution, use this PowerShell Script:

$farm = Get-SpFarm
$SolutionFile = $farm.Solutions.Item("SolutionName.wsp").SolutionFile
$SolutionFile.SaveAs("D:\SolutionFile.wsp")

Download SharePoint solution from the farm in SharePoint 2007:

[void][reflection.assembly]::LoadWithPartialName("Microsoft.SharePoint")

#Get Farm object
[Microsoft.SharePoint.Administration.SPFarm]$farm = [Microsoft.SharePoint.Administration.SPFarm]::get_Local()

#Create a Directory for Solutions
if ( (Test-Path -path "c:\Solutions\") -ne $True)
{
 New-Item c:\Solutions\ -type directory
}

$dirName = "c:\Solutions"

foreach ($solution in $farm.Solutions)
{   
    Write-Host "Downloading solution $($Solution.Name)"
    $filename = $Solution.SolutionFile.Name
    $solution.SolutionFile.SaveAs("$dirName\$filename")
}

Salaudeen Rajack

Salaudeen Rajack - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time articles!

One thought on “Extract and Download All Installed Farm Solution Packages (WSP Files) in SharePoint

  • Thanks for nice article about “Want to Extract the .WSP file from installed Solutions in SharePoint?”

    Regards
    https://www.sharepoint.inf4web.com

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *