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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
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:
1 2 3 4 5 6 7 |
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.