How To Get Backup Of An Already-Deployed Solution On Farm

In one of my projects, the project solution was not properly managed and we were not sure about WSP. We have published an updated one.

So here one big question arose while doing deployment on UAT environment

"How we can get backup of an already-deployed solution on farm?"

And yes, we found the answer for this question. A simple three-line powershell script gets the work done.

Those who are not familiar with running powershell scripts, follow the below steps,

  1. Log in to server where sharepoint farm is installed, the logged in account must be a sharepoint farm admin.
  2. Open sharepoint management shell, and remember while openning power shell, right click on icon and select run as administrator.
  3. Run below powershell script
    1. $farm = Get-SPFarm  
    2. $file = $farm.Solutions.Item("MySolution.wsp").SolutionFile  
    3. $file.SaveAs("c:\MySolution.wsp")  
    Note

    Put your solution name in place of "MySolution.wsp"

  4. Your WSP will be saved at the drive location you have specified.