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
$_.SolutionFile.SaveAs($filename)
}
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
$_.SolutionFile.SaveAs($filename)
}
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?