Introduction
I am to share the Powershell script which is use to deploy the wsp.
Script
Follow the below steps to create ps1 file
- Open a notepad and paste this script
try
{
Write-Host "Please make sure that ""SharePoint Administration"" and ""SharePoint Timer Service"" are running and then Press a key to proceed with installation.."
$pressedKey = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
$currentLocation = Get-Location
$solutionPath = "Give path of wsp with wsp file"
#Step 1: Add WSP to solution store
Write-Host "Adding solution to solution store.. " -ForegroundColor Yellow
$spSolution = Add-SPSolution $solutionPath
#Step 2: Deploying the solution to required web application
#$webApplication = Read-Host "Please enter my site web application url to which solution needs to be deployed (Eg. http://<yourserver:port): "
Write-Host "Deploying" $spsolution.Name ".." -ForegroundColor Yellow
Install-SPSolution -Identity $spSolution.Name -GACDeployment
#Step 3: Waiting for deployed status
do
{
Start-Sleep -Seconds 1
Write-Host "Waiting for Deployed status.."
}while(-not($spSolution.Deployed))
#Step 4: Completing installation
Write-Host "wsp installation successful!!!" -ForegroundColor Green
}
catch
{
Write-Host "Following is the error occurred while executing this script -->" $_
}
- Then, save the text file with .ps1 extension
- This is it, just run the powershell script file to deploy the wsp
No comments:
Post a Comment