When I was working on maintenance project, I got a requirement to restore production back-up in my local box to do more investigation on production issue. I was able to take back of site collection and restored in to my local SharePoint portal. But in this back up, custom features that are installed on production and activated for this site collection were not moved. So I thought of taking back-up for all WSP that are installed on the production environment. I did little R&D and found below commands. These are pretty simple and useful. It resolved all my burdens.
$farm = Get-SPFarm
$file = $farm.Solutions.Item(“extendeddiagnosticproviders.wsp”).SolutionFile
Create ps1 file with above commands and run in power shell on production environment (where SharePoint configured). It saves a copy with the file name in the given folder. That file can be moved to your local system and can deploy into your box, just like another WSP.