I'm trying to automate the process of downloading one solution and then add/install the same solution to other site collections. The first thing to do would be to download the freshly created solution that was saved in the solution gallery of one site - in my case the template of a site.

For farm solutions the relevant code would be this:

Get-SPSolution | % {
  $filename = $_.SolutionFile.Name

Since a saved site template is not a farm solution but gets saved in the solution gallery of a site I would assume to do this:

Get-SPUserSolution -Site http://example | % {
  $filename = $_.SolutionFile.Name

But this does not work because Get-SPUserSolution does not seem to return objects containing the SolutionFile member.

My question is: Is it even possible to download a WSP package from the solution gallery of a site via powershell?

2 Answers 2


Try this code,it will donwload it from the site collection

$spWeb = Get-SPWeb -Identity http://SPServer 
$listTemplate = [Microsoft.SharePoint.SPListTemplateType]::SolutionCatalog
$solGallery = $spWeb.Site.GetCatalog($listTemplate)
$solGallery.Items | ForEach-Object {
  if($_["Title"] -eq "the title of the solution") {
    [System.IO.FileStream]$outStream = New-Object 
      System.IO.FileStream("The local location to save the solution",
    $fileData = $_.File.OpenBinary();
    $outStream.Write($fileData, 0, $fileData.Length);

You can also do it with SharePoint Designer, going to "All files"-"_catalogs"-"Solutions", select your solution and "Export file" from the Ribbon.

Best regards.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.