Quick Tip: Upgrading a bunch of SharePoint .wsp’s at one time

I had to upgrade all of the solution packages on my dev virtual machine and thought I would share a simple method to do the upgrade.

The first step is to make sure the path to the STSADM tool is in your environment path. Once done you can easily call STSADM from any command window or from within Powershell.

Open Powershell and Set-Location (shortcut is CD) to the directory with all of your .wsp’s. Then simply run the following Powershell command depending on your environment

Single Dev Machine:

get-childitem *.wsp | ForEach-Object { “Upgrading $($_.Name)”; stsadm.exe -o upgradesolution -name $_.Name -filename $_.Name –local -allowgacdeployment }

Multi-server farm environment:

get-childitem *.wsp | ForEach-Object { “Upgrading $($_.Name)”; stsadm.exe -o upgradesolution -name $_.Name -filename $_.Name –immediate –allowgacdeployment; stsadm –o execadmsvcjobs }

That’s it!

[Update: 2009-12-17]

I’ve needed the  following several times over the last few weeks. Here’s how to add and deploy a large number of .wsp’s at once:

gci . -include *.wsp -recurse | ForEach-Object { “Adding $($_.Name)”; stsadm.exe -o addsolution -filename $_.FullName; “Deploying $($_.Name)”;  stsadm -o deploysolution -name $_.Name -local -allowgacdeployment }

Comments (0)