How to download wsp solution files from Central Admin in SharePoint

In case there is a need to download a single solution from Central Admin, following PowerShell script can be used to download wsp file

$farm = Get-SPFarm
$file = $farm.Solutions.Item("SampleSolution.wsp").SolutionFile
$file.SaveAs("c:\temp\SampleSolution.wsp")


To download all solutions files deployed to a SharePoint server farm, use following script

$farm = Get-SPFarm
$SavedPath = "c:\temp\"   
$mySolutions = $farm.Solutions

foreach($mySolution in $mySolutions)
{
    [string]$myOutputPath = $SavedPath + $mySolution.Name
    $mySolution.SolutionFile.SaveAs($myOutputPath);
}


No comments:

Post a Comment