Advertisement
private775

Install and deploy SharePoint solutions

Dec 22nd, 2014
354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # install wsp files and deploy to $waUrl web application
  2.  
  3. $waUrl = "http://devintranet/"
  4. $scriptsRootFolder = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
  5. $wspDir = "$($scriptsRootFolder)\WSPs"
  6.  
  7. $wspNames = @(
  8.     "nova.xxx1.wsp"
  9.     "nova.xxx2.wsp"
  10.     "nova.xxx3.wsp"
  11.     "nova.xxx4.wsp"
  12. )
  13.  
  14. foreach($wspName in $wspNames){
  15.     $wspPath = "$($wspDir)\$($wspName)"
  16.     Add-SPSolution -LiteralPath $wspPath -Verbose -Confirm:$false
  17.  
  18.     $sol = Get-SPSolution -Identity $wspName
  19.     if($sol.ContainsWebApplicationResource){
  20.         Install-SPSolution -Identity $wspName -GACDeployment:$true -Confirm:$false -Verbose -WebApplication $waUrl
  21.     } else {
  22.         Install-SPSolution -Identity $wspName -GACDeployment:$true -Confirm:$false -Verbose
  23.     }
  24.     Write-Host -NoNewline "Deploying $($wspName) "
  25.     Start-Sleep -Seconds 3
  26.     $sol = Get-SPSolution -Identity $wspName
  27.     while($sol.JobExists){
  28.         Write-Host -NoNewline "."
  29.         Start-Sleep -Seconds 3
  30.         $sol = Get-SPSolution -Identity $wspName
  31.     }
  32.    
  33.     Write-Host " Done"
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement