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.2\WSP\Custom_Lib.wsp"
 5 Add-SPSolution -LiteralPath "C:\Deploy_2013-08-21_v2.2\WSP\Custom_WP_FilterOfStaffList.wsp"
 6 Add-SPSolution -LiteralPath "C:\Deploy_2013-08-21_v2.2\WSP\Custom_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.2\WSP\Custom_ContentType.wsp" -GACDeployment
14 Update-SPSolution -Identity Custom_RB_StaffList.wsp -LiteralPath "C:\Deploy_2013-08-21_v2.2\WSP\Custom_RB_StaffList.wsp" -GACDeployment
15 Update-SPSolution -Identity Custom_WP_RBPermissionOfStaffList.wsp -LiteralPath "C:\Deploy_2013-08-21_v2.2\WSP\Custom_WP_RBPermissionOfStaffList.wsp" -GACDeployment
16 Update-SPSolution -Identity Custom_WP_SearchStaffList.wsp -LiteralPath "C:\Deploy_2013-08-21_v2.2\WSP\Custom_WP_SearchStaffList.wsp" -GACDeployment
17 Update-SPSolution -Identity Custom_WP_SeatingPlan.wsp -LiteralPath "C:\Deploy_2013-08-21_v2.2\WSP\Custom_WP_SeatingPlan.wsp" -GACDeployment
18 Update-SPSolution -Identity Custom_WP_StaffSearch.wsp -LiteralPath "C:\Deploy_2013-08-21_v2.2\WSP\Custom_WP_StaffSearch.wsp" -GACDeployment
19 Update-SPSolution -Identity Custom_WP_IconandSloganbanner.wsp -LiteralPath "C:\Deploy_2013-08-21_v2.2\WSP\Custom_WP_IconandSloganbanner.wsp" -GACDeployment
20 Update-SPSolution -Identity Custom_WP_NewAndEvent.wsp -LiteralPath "C:\Deploy_2013-08-21_v2.2\WSP\Custom_WP_NewAndEvent.wsp" -GACDeployment
21 Update-SPSolution -Identity Custom_WP_DocumentSharing.wsp -LiteralPath "C:\Deploy_2013-08-21_v2.2\WSP\Custom_WP_DocumentSharing.wsp" -GACDeployment
22 Update-SPSolution -Identity Custom_WP_TrainingCenter.wsp -LiteralPath "C:\Deploy_2013-08-21_v2.2\WSP\Custom_WP_TrainingCenter.wsp" -GACDeployment
23 Update-SPSolution -Identity Custom_WP_ImageBanner.wsp -LiteralPath "C:\Deploy_2013-08-21_v2.2\WSP\Custom_WP_ImageBanner.wsp" -GACDeployment
24 Update-SPSolution -Identity Custom_WP_OnlineSurvey.wsp -LiteralPath "C:\Deploy_2013-08-21_v2.2\WSP\Custom_WP_OnlineSurvey.wsp" -GACDeployment
25 Update-SPSolution -Identity Custom_WP_NewsArticles.wsp -LiteralPath "C:\Deploy_2013-08-21_v2.2\WSP\Custom_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 }

 

转载于:https://www.cnblogs.com/huangjianwu/p/4538237.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值