Advertisement
PtiTom

SP Deployment Script

Mar 9th, 2012 (edited)
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function Get-ScriptDirectory
  2. {
  3. $Invocation = (Get-Variable MyInvocation -Scope 1).Value
  4. Split-Path $Invocation.MyCommand.Path
  5. }
  6.  
  7.  
  8. #cls
  9. Set-Location (Get-ScriptDirectory)
  10. $webSiteUrl = Read-Host -Prompt "URL du site à installer"
  11. $Override = $True
  12.  
  13. #DO NOT CHANGE ANYTHING BELOW THIS LINE.
  14. Add-PSSnapIn Microsoft.SharePoint.PowerShell
  15.  
  16. $spWeb = Get-SPSite $webSiteUrl | Get-SPWeb
  17. Write-Host "Will install and set parameters to : $spWeb"
  18. Write-Host "Press [ENTER] to set or Ctrl-C to abort."
  19. Read-Host
  20.  
  21. Write-Host "Install Solution"
  22. $WSPPath = (Get-ScriptDirectory) + "\Tech.SharePoint.Core.Params.wsp"
  23. Add-SPSolution -LiteralPath $WSPPath
  24. #    Add-SPSolution [-LiteralPath] <String> [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-Language <UInt32>] [-WhatIf [<SwitchParameter>]] [<CommonParameters>]
  25. Install-SPSolution -Identity Tech.SharePoint.Core.Params.wsp -Force -GACDeployment
  26. # -WebApplication ($spWeb.Site.WebApplication)
  27. #    Install-SPSolution [-Identity] <SPSolutionPipeBind> [-AllWebApplications <SwitchParameter>] [-AssignmentCollection
  28. #    <SPAssignmentCollection>] [-CASPolicies <SwitchParameter>] [-Confirm [<SwitchParameter>]] [-Force <SwitchParameter>
  29. #    ] [-GACDeployment <SwitchParameter>] [-Language <UInt32>] [-Local <SwitchParameter>] [-Time <String>] [-WebApplicat
  30. #    ion <SPWebApplicationPipeBind>] [-WhatIf [<SwitchParameter>]] [<CommonParameters>]
  31.  
  32. Write-Host "Press [ENTER] to continue or Ctrl-C to abort."
  33. Read-Host
  34.  
  35. [System.Reflection.Assembly]::Load("Tech.SharePoint.Core.Params, Version=1.0.0.0, Culture=neutral, PublicKeyToken=73d53a117b0ec4ff");
  36. [Tech.SharePoint.Core.Params.TechUtils]::SetParam($spWeb, "Application", "ParamName", "ParamValue", "Description", $Override);
  37.  
  38. Remove-PSSnapIn Microsoft.SharePoint.PowerShell
  39. Write-Host "Parameters Set !"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement