SharePoint 2010 Cookbook: PowerShell Script to Automatically Deploy Bamboo Web Parts

Life is too short to wait! Being a Support Engineer at Bamboo Solutions, my everyday work involves a lot of installing and testing of Web Parts. Basically, I need to install the Web Part to different environments and try to duplicate the same issues that customers are experiencing. Then, when the fix is implemented, I will install it again to check, repeatedly, until I can confirm that the fix is OK. This obviously takes a lot of time. The Bamboo Solutions Web Part Setup is good because it helps us know what is happening through each step. But what if we are already familiar with the process and just want to quickly deploy the Web Part? In this post, I will demonstrate how we can easily install a Bamboo Solutions Web Part using PowerShell script and save some time to do more valuable things.


How can I speed up the manual installation of Bamboo Web Parts, and automatically deploy Web Parts via a PowerShell script?



There are many articles on the Internet that explain how to deploy a solution using a PowerShell script. One such article which I found to be particularly useful is from Sohel’s Blog:

So I’m not going to cover the basics here, but rather talk about how we can implement the script to run with the Bamboo Solutions Web Part setup package.

First, verify that you possess the following permissions:

  • SharePoint Farm Administrator.
  • Local Server Administrator on all Web servers.
  • db_owner permission on the content database

In this example, I will deploy Calendar Plus Web Part. After clicking to download the Web Part solution from the Bamboo Solutions store, we are given an .exe file named “HW20.R4.SP2010.SL.exe”. Running it will extract all content to a folder named “HW20.R4.SP2010.SL” and will also open up the Web Part Setup as shown below:



Close the Web Part Setup and take a look at the extracted folder:

We will need to deploy all of the solutions (.wsp) under this folder, except Web License Manager. The logic is simple:

  • Find all .wsp solutions under this folder and filter out the Web License Manager solution.
  • For each solution, check whether it has already been deployed. If yes, remove it.
  • If the solution has not been deployed, install it.

Here is the deployment script (DeployBambooWebpart.ps1):

Add-PsSnapin Microsoft.SharePoint.PowerShell
Start-SPAssignment -Global    # This cmdlet takes care of the disposable objects to prevent memory leak.
function WaitForJobToFinish ([string]$solutionName)    # This function waits for the deployment job to finish before doing the next command.
    $JobName = "*solution-deployment*$solutionName*"
    $job = Get-SPTimerJob | ?{ $_.Name -like $JobName }
    if ($job -eq $null) 
        Write-Host "Timer job not found"
        $JobFullName = $job.Name
        Write-Host -NoNewLine "Waiting to finish job $JobFullName"
        while ((Get-SPTimerJob $JobFullName) -ne $null) 
            Write-Host -NoNewLine .
            Start-Sleep -Seconds 2
        Write-Host  "Finished waiting for job.."
function InstallSolution ([string]$solutionName,[string]$solutionPath)        # This function is used to install a solution.
    $solution=Get-SPSolution -Identity $solutionName -ErrorAction:SilentlyContinue    # Get the solution.
    if ($solution -ne $null)        # Check whether the solution exists in the Solutions Store.
    if ($solution.Deployed)        # Check whether the solution is already deployed.
        write-Host $solutionName "is already deployed, going to uninstall it"
        write-Host "Retracting" $solutionName
        if ($solution.ContainsWebApplicationResource)    # If the solution contains Web Application Resource, use this command.
        Uninstall-SPSolution -identity $solutionName -allwebapplication -confirm:$false
            else                        # Otherwise, use this command.
        Uninstall-SPSolution -identity $solutionName -confirm:$false
        Write-Host "Waiting for job to finish"    
                 WaitForJobToFinish $solutionName
              Write-Host "Removing" $solutionName            # Remove solution from store.
               Remove-SPSolution –Identity $solutionName -confirm:$false
    Write-Host "Adding" $solutionName "to the Solutions Store"    # Add solution to Solutions Store.
    Add-SPSolution -LiteralPath $solutionPath
    $solution=Get-SPSolution -Identity $solutionName        # Assign solution to a variable.
    Write-Host "Deploying" $solutionName
    if ($solution.ContainsWebApplicationResource)        # If the solution contains Web Application Resource, use this command.
        Install-SPSolution –Identity $solutionName –allwebapplication –GACDeployment -CASPolicies
    else                                # Otherwise, use this command.
        Install-SPSolution –Identity $solutionName –GACDeployment -CASPolicies
    Write-Host "Waiting for job to finish" 
    WaitForJobToFinish $solutionName
$currentDir=$args[0]    # Assign the script parameter (current directory)
$solutionFiles=Get-ChildItem $currentDir*.* -recurse -include *.wsp -exclude Bamboo.UI.Licensing.wsp    # Get all solutions under this directory and filter out Bamboo Web License Manager.
foreach ($solutionFile in $solutionFiles)            # For each solution found, install it
    InstallSolution $solutionName $solutionPath
    Get-SPSolution -Identity $solutionName | select Deployed    # Display deployment result.
    write-Host ""                            # Add an empty line and go on to the next solution
Stop-SPAssignment -Global
Remove-PsSnapin Microsoft.SharePoint.PowerShell
write-Host "Finished script."

We can then create a batch file to run this script as follows:

cd /d %~dp0
powershell -noexit -file    ".DeployBambooWebPart.ps1" "%CD%"

Put both the script and batch file in the extracted folder (HW20.R4.SP2010.SL) and run the batch file to install this Web Part.



  • This method works with both SharePoint 2010 Foundation and Server.
  • This script has not been tested with all Bamboo Solutions Web Parts. Theoretically, it should work with most of them, but will not work with all of them. For example, if we try to deploy Bamboo List Rollup Web Part R5.0 using this script, we will get an error because some solutions need to be deployed prior to others.

See Also:

All SharePoint Versions

The web parts are functional components that extend your SharePoint environment whether it’s hosted, on-premises, or part of Microsoft® Office 365.

SharePoint 2013, 2016, 2019, Online (Office 365)

On-Premises Only

These web parts extend SharePoint beyond its out-of-the-box capabilities by tailoring it to your requirements with Bamboo Solution’s growing portfolio of SharePoint Web Parts.

SharePoint 2013, 2016, 2019


Product Suites

Experience greater power and savings by bundling our SharePoint apps and web parts.

Essentials Suite

Essentials Plus Suite

Bamboo Premier Suite

Project Management Suite

Knowledge Management Suite

External User Manager


For more information on our product suites, contact us.

Featured Services

SharePoint Health Check

A SharePoint Health Check will identify the causes of issues and risks associated with your specific environment, and is custom tailored to provide you with the best recommendations to optimize your SharePoint environment.

SQL Health Check

Document recommendations relating to performance, stability, availability, or a specific focus you request of your SQL Server database instances.

My SharePointXperts

The truth is that each SharePoint skill may not be a full time job for many organizations, and it is nearly impossible for one person to do everything you need – so augment your team with SharePointXperts; providing the skill sets you need when you need them!