PowerShell for Auto-Installing All WSPs in a Directory (SharePoint 2010 or 2007) 

Tags:

I created a PowerShell script which will traverse a directory and install all WSPs it finds into SharePoint. You can either run the script at the same location where the WSPs are or you can just execute the script adding a parameter “SolutionInstallPath” and specify the directory where your solutions exist. If the directory is invalid you will receive an execution error. If no solutions are found then it will gracefully let you know. if solutions are found the following will occur for each solution.

 

  1. Check to see if the solution is deployed and if so retract the solution. It will now wait for retraction to complete then
  2. Delete the solution. If no solution was deployed then it will move to step 3
  3. Add the solution to the store
  4. Deploy the solution.

 

Once all solutions are being deployed it will then open the browser so that you can review your deployment status. I felt it better to let you monitor the status via the browser then writing the sleep script to do it for you. I personally as an Admin, like the control of seeing it happen in SharePoint.

 

While I have a Batch file and an MSI which can do this I thought it might be better if I wrote a PowerShell script for doing the install as I have a lot more flexibility in PowerShell without the need to compile a build every time. In the future I will add a logger and an ability specify if you do not want to open the browser but monitor deployment via the script, but for now, this will do. (Perhaps even activation – but that’s for a lot later)

 

You must execute this from a PowerShell Command window which is registered for the Microsoft.SharePoint.PowerShell cmdlet. You must also do so as an Administrator.

 

To Download the PowerShell Script Click Here

 

Use:

InstallAllSolutions SolutionInstallPath <PhysicalPathToSolutions>

 

Examples:

.\InstallAllSolutions.ps1 (Will find all solutions where the script lives)

.\InstallAllSolutions.ps1 c:\wsps\ (Will find all solutions in the directory “c:\wsps\”)

.\InstallAllSolutions.ps1 –SolutionInstallPath c:\wsps\ (Will find all solutions in the directory “c:\wsps\”)

 
Posted by Adam Macaulay on 24-Jan-10
0 Comments  |  Trackback Url  |  Link to this post | Bookmark this post with:        
 

Comments

Name:
URL:
Email:
Comments:

CAPTCHA Image Validation