Upgrade a SharePoint 2010 solution with features using Power Shell

Having finished the first three SharePoint 2010 portals with our team, we have come across the inevitable need to change certain things in an already running website. Since we obviously cannot retract, uninstall, reinstall and redeploy our solutions (the data would be lost), we have started looking into the upgrade process in SharePoint 2010. After having gained a lot of knowledge from this blog post by Chris O’Brien, we were ready to deploy our upgrades.

In his blog, Chris describes his SharePoint Feature Upgrade Kit, which provides a very handy way to graphically upgrade features, as well as to do the same by using Power Shell. However, even using the Power Shell version of his tools requires installing a few things to the GAC, which we would prefer not to have to ask our maintenance team. So we have set out to make some simple Power Shell scripts of our own which we can just put in a .ps1 file to give to our administrators. As Chris notes, there are no built-in commands to upgrade features easily, so we have to do this the ‘hard’ way ;)

This script will upgrade one SharePoint solution and then upgrade all of the features (both site and web scoped) it contains on the given SPSite.
Continue reading