[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$farm = [Microsoft.SharePoint.Administration.SPFarm]::Local
$farm.Solutions | % {
$filename = ($pwd.ToString() + "\" + $_.SolutionFile.Name);
write-host ("Saving" + $filename);
$_.SolutionFile.SaveAs($filename)
}

$farm = Get-SPFarm
$file = $farm.Solutions.Item("extendeddiagnosticproviders.wsp").SolutionFile
$file.SaveAs("c:\temp\extendeddiagnosticproviders.wsp")
05-11 18:38