Many times we come across a situation where we have the latest WSP with us in the Solution form (Visual Studio Solution), but we don’t have the installed version of WSP from the SharePoint farm (Central Administrations > System Settings > Manage farm Solutions).
So to get a copy of Installed version of WSP file from the SharePoint farm, following is the PowerShell snippet, which will download the WSP file to the location specified in the cmdlet:
$farm = Get-SpFarm $file = $farm.Solutions.Item("MyWSPName.wsp").SolutionFile $file.SaveAs("C:\Backup\MyWSPName.wsp")
Above snippet will save WSP file to the path
C:\Backup. Make sure WSP file name
MyWSPName.wsp specified does exist on the farm.
Note that in order to run this command, you need to be a member of the Farm Administrators group and have permission to the configuration database.