I have written a nifty little tool in PowerShell that eases the deployment of SharePoint solutions (WSP) files. The tool serves as a management tool for new features. It uses an XML configuration to select a bunch of solutions and deploys them to the farm. Now, despite our best intentions and the best efforts of QA, we somehow manage to upload solutions that do not do exactly what they are supposed to do, or – horror of horrors – even disrupt previous behavior.
So, the tool is also used to restore the site to its previous glory. It is actually a breeze to do so. You just change the purpose to “restore” and point to the backup directory created at the time you “Deploy”ed.
Here is the purpose of this blog: I needed to store the old version of the solution in the backup directory and used the Name property of the Get-SPSolution. WRONG!! the Name property appends a naughty prefix – “SPSolution Name=” to the real name. In the screen shot below, the 1st arrowed line shows this effect and the 2nd shows how it ought to be.
The line surrounded in red shows how the "error" was made, the 2 lines surrounded in blue show how to use the $file.Name in getting the desired result.
That’s All Folks!!