Friday, April 10, 2015

How to Deploy Multiple WSP Solutions using PowerShell in SharePoint

Requirement: Have a bunch of WSP solution packages and had to add and deploy all of them to a cloned SharePoint environment.

Solution: Lets bulk deploy all WSP solutions from a folder to SharePoint using PowerShell.

PowerShell script to bulk add Multiple solutions:

Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue

Function WaitForInsallation([string] $SolutionName)
        Write-Host -NoNewline "Waiting for deployment job to complete" $SolutionName "."
        $WSPSol = Get-SPSolution $SolutionName
            sleep 2
            Write-Host -NoNewline "."
            $wspSol = Get-SPSolution $SolutionName
        Write-Host "job Completed" -ForegroundColor green

Function Deploy-SPSolution ($WSPFolderPath)
    #Get all wsp files from the given folder
    $WSPFiles = Get-childitem $WspFolderPath | where {$_.Name -like "*.wsp"}

    #Iterate through each wsp and Add in to the solution store
    ForEach($File in $wspFiles)
        $wsp = Get-SPSolution | Where {$_.Name -eq $File.Name}

        if($wsp -eq $null)
            write-host "Adding WSP solution:"$File.Name
            Add-SPSolution -LiteralPath ($WspFolderPath + "\" + $file.Name)
            write-host "solution already exists!"


        Deploy-SPSolution "C:\WSPFiles"
    write-host $_.exception
Once added to the SharePoint solution store, You can either deploy them to the targeted web applications/globally using PowerShell,
Install-SPSolution -Identity "Solution-Name" -Webapplication "Web-App-URL" -GacDeployment -Force

Deploy SharePoint Solution Manually:
or You can deploy from SharePoint Central Administration site manually.
  • Navigate to SharePoint 2013/2016 Central Administration site.
  • Click on System Settings >> Manage Farm Solutions under Farm Management
  • Pick the relevant solution from the solution store
  • Click on "Deploy Solution" to start deploying the solution.
    sharepoint powershell deploy multiple solutions
You may also have to activate necessary features that came through deployed solutions!

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.

Check out these SharePoint products:

No comments :

Post a Comment

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...