Tuesday, 11 February 2014

PowerShell - Bulk Solution Deployment

PowerShell - Bulk Solution Deployment <Add & Install Solution> :-

#Loading Snap in for Microsoft.Sharepoint.Powershell
$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}

if ($snapin -eq $null)
{

Write-Host "Loading SharePoint Powershell Snapin" -ForegroundColor Green
$snapin = Add-PSSnapin "Microsoft.Sharepoint.Powershell"

Write-Host $snapin
}

$Path  = Read-HOst "Enter network folder path for WSPs (e.g F:\WSPs)"
#"F:\WSPs"
$WebApp = Read-Host "Enter Web Application URL (e.g http://<site URL>/)"
#"http://<Site URL>/"
Write-Host "Adding Solutions to solution store..." -ForegroundColor Yellow

Add-SPSolution -LiteralPath $Path\WebTemplates.Core.Features.wsp
Add-SPSolution -LiteralPath $Path\TEMPLATE.wsp
Add-SPSolution -LiteralPath $Path\Working.Site.wsp
Add-SPSolution -LiteralPath $Path\Presentation.wsp
Add-SPSolution -LiteralPath $Path\Master.wsp
Add-SPSolution -LiteralPath $Path\MasterpageExtension.wsp
Add-SPSolution -LiteralPath $Path\ContentTypes.wsp
Add-SPSolution -LiteralPath $Path\DocumentPromotion.wsp



Write-Host "Solutions uploaded to solution store !!!" -ForegroundColor Green

Write-Host "Deploying Solutions..." -ForegroundColor Yellow

Install-SPSolution -Identity WebTemplates.Core.Features.wsp -GacDeployment
Install-SPSolution -Identity TEMPLATE.wsp -GacDeployment
Install-SPSolution -Identity Working.Site.wsp -GacDeployment
Install-SPSolution -Identity Presentation.wsp -GacDeployment -Webapplication $WebApp
Install-SPSolution -Identity Master.wsp -GacDeployment
Install-SPSolution -Identity MasterpageExtension.wsp -GacDeployment
Install-SPSolution -Identity ContentTypes.wsp -GacDeployment
Install-SPSolution -Identity DocumentPromotion.wsp -GacDeployment


Write-Host "Solutions Deployed !!!" -ForegroundColor Green

No comments:

Post a Comment