Imagine you have a farm with a solution deployed to it; but, have lost the raw solution package and you need to work on the solution. Or, someone deployed a solution to the farm and you need to inspect it. Here is a script I found that works fantastic for going into the farm and getting all solutions, exporting the wsp’s to a file so that they can then be inspected, re-deployed, or deployed, somewhere else, etc.
Add-PSSnapin Microsoft.SharePoint.PowerShell –erroraction SilentlyContinue ## setup our output directory $dirName = "e:\Exported Solutions" Write-Host Exporting solutions to $dirName foreach ($solution in Get-SPSolution) { $id = $Solution.SolutionID $title = $Solution.Name $filename = $Solution.SolutionFile.Name Write-Host "Exporting ‘$title’ to …\$filename" -nonewline try { $solution.SolutionFile.SaveAs("$dirName\$filename") Write-Host " – done" -foreground green } catch { Write-Host " – error : $_" -foreground red } }
Here’s a script to get just one solution:
asnp *SharePoint* $farm = Get-SPFarm $file = $farm.Solutions.Item(“Coolio_ProjectDeletion.wsp”).SolutionFile $file.SaveAs("C:\Deployment\Coolio_ProjectDeletion_Webpart\BackUp\Coolio_ProjectDeletion.wsp”)
You must be logged in to post a comment.