Monday, November 24, 2014

Extract wsp packages which are currently installed in the Sharepoint solution store via PowerShell

During installation of updates to the Sharepoint environment, especially on production environment, it is good to have rollback plan. One of the step of this rollback plan is to restore wsp packages which were used before installation. Here is the PowerShell script which will enumerate and save all wsps packages (farm solutions) currently installed to the solutions store to the local file system:

   1: (Get-SPFarm).Solutions | ForEach-Object { $var = (Get-Location).Path +
   2:     "\" + $_.Name; $_.SolutionFile.SaveAs($var) }

(you need to use it as one line script. I added line break for better readability). Having this script you may backup farm solutions wsps before to perform update and rollback them if needed.

No comments:

Post a Comment