• SharePoint PowerShell部署开发好的WebPart到服务器上


    内容仅供参考,需结合实际需求来处理。

    =========SharePoint 环境下运行ps1文件,ps1内容如下=======

     1 Set-ExecutionPolicy ByPass
     2 Add-PSSnapin Microsoft.SharePoint.PowerShell
     3  
     4 Add-SPSolution -LiteralPath "C:Deploy_2013-08-21_v2.2WSPCustom_Lib.wsp"
     5 Add-SPSolution -LiteralPath "C:Deploy_2013-08-21_v2.2WSPCustom_WP_FilterOfStaffList.wsp"
     6 Add-SPSolution -LiteralPath "C:Deploy_2013-08-21_v2.2WSPCustom_Lookup_ListRelation.wsp"
     7  
     8 Install-SPSolution -Identity Custom_Lib.wsp -WebApplication http://win2012sp2013:1000/
     9 Install-SPSolution -Identity Custom_WP_FilterOfStaffList.wsp -WebApplication http://win2012sp2013:1000/
    10 Install-SPSolution -Identity Custom_Lookup_ListRelation.wsp -WebApplication http://win2012sp2013:1000/
    11  
    12  
    13 Update-SPSolution -Identity Custom_ContentType.wsp -LiteralPath "C:Deploy_2013-08-21_v2.2WSPCustom_ContentType.wsp" -GACDeployment
    14 Update-SPSolution -Identity Custom_RB_StaffList.wsp -LiteralPath "C:Deploy_2013-08-21_v2.2WSPCustom_RB_StaffList.wsp" -GACDeployment
    15 Update-SPSolution -Identity Custom_WP_RBPermissionOfStaffList.wsp -LiteralPath "C:Deploy_2013-08-21_v2.2WSPCustom_WP_RBPermissionOfStaffList.wsp" -GACDeployment
    16 Update-SPSolution -Identity Custom_WP_SearchStaffList.wsp -LiteralPath "C:Deploy_2013-08-21_v2.2WSPCustom_WP_SearchStaffList.wsp" -GACDeployment
    17 Update-SPSolution -Identity Custom_WP_SeatingPlan.wsp -LiteralPath "C:Deploy_2013-08-21_v2.2WSPCustom_WP_SeatingPlan.wsp" -GACDeployment
    18 Update-SPSolution -Identity Custom_WP_StaffSearch.wsp -LiteralPath "C:Deploy_2013-08-21_v2.2WSPCustom_WP_StaffSearch.wsp" -GACDeployment
    19 Update-SPSolution -Identity Custom_WP_IconandSloganbanner.wsp -LiteralPath "C:Deploy_2013-08-21_v2.2WSPCustom_WP_IconandSloganbanner.wsp" -GACDeployment
    20 Update-SPSolution -Identity Custom_WP_NewAndEvent.wsp -LiteralPath "C:Deploy_2013-08-21_v2.2WSPCustom_WP_NewAndEvent.wsp" -GACDeployment
    21 Update-SPSolution -Identity Custom_WP_DocumentSharing.wsp -LiteralPath "C:Deploy_2013-08-21_v2.2WSPCustom_WP_DocumentSharing.wsp" -GACDeployment
    22 Update-SPSolution -Identity Custom_WP_TrainingCenter.wsp -LiteralPath "C:Deploy_2013-08-21_v2.2WSPCustom_WP_TrainingCenter.wsp" -GACDeployment
    23 Update-SPSolution -Identity Custom_WP_ImageBanner.wsp -LiteralPath "C:Deploy_2013-08-21_v2.2WSPCustom_WP_ImageBanner.wsp" -GACDeployment
    24 Update-SPSolution -Identity Custom_WP_OnlineSurvey.wsp -LiteralPath "C:Deploy_2013-08-21_v2.2WSPCustom_WP_OnlineSurvey.wsp" -GACDeployment
    25 Update-SPSolution -Identity Custom_WP_NewsArticles.wsp -LiteralPath "C:Deploy_2013-08-21_v2.2WSPCustom_WP_NewsArticles.wsp" -GACDeployment

    另外有用的语句:

    1 Uninstall-SPSolution –Identity Clone_List_Scheduler.wsp
    2 Remove-SPSolution -Identity Clone_List_Scheduler.wsp
     

    使用Windows Powershell ISE 64位,附加SharePoint环境的dll
     1 write-host 
     2 write-host "Loading PowerShell environment for SharePoint" -foregroundcolor Green
     3 write-host 
     4 # unload & load the sharepoint powershell snapin
     5 $snapin = Get-PSSnapin | where-object { $_.Name -eq 'Microsoft.SharePoint.PowerShell' }
     6 if ($snapin -ne $null){
     7  write-host "Unloading SharePoint PowerShell Snapin..." -foregroundcolor Blue
     8  remove-pssnapin "Microsoft.SharePoint.PowerShell"
     9  write-host "SharePoint PowerShell Snapin unloaded." -foregroundcolor Green
    10 }
    11 $snapin = Get-PSSnapin | where-object { $_.Name -eq 'Microsoft.SharePoint.PowerShell' }
    12 if ($snapin -eq $null){
    13  write-host "Loading SharePoint PowerShell Snapin..." -foregroundcolor Blue
    14  add-pssnapin "Microsoft.SharePoint.PowerShell"
    15  write-host "SharePoint PowerShell Snapin loaded." -foregroundcolor Green
    16 }
  • 相关阅读:
    日记功能发布
    功能小改进
    CuteEditor 6.0一个很奇怪的Bug
    关于博客园.NET俱乐部的公告
    新功能发布
    建立了一个博客园创业者QQ群
    思想决定生活 《卡耐基成功之道全书》读书笔记
    建立了一个英语学习小组
    实际上我没有选择的余地
    公告
  • 原文地址:https://www.cnblogs.com/huangjianwu/p/4538237.html
Copyright © 2020-2023  润新知