SharePoint 解决方案和功能-PowerShell

1. 添加解决方案到SharePoint场

Add-SPSolution "c:\newsolution.wsp"

2. 获取场中的解决方案

Get-SPSolution

3. 获取指定的解决方案

$solution = Get-SPSolution
-Identity c0e31dec-294d-4f2d-9ae4-f2e637c766bd

4. 部署解决方案到Web应用程序

$solution = Get-SPSolution
-Identity c0e31dec-294d-4f2d-9ae4-f2e637c766bd
Install-SPSolution $solution –WebApplication "SharePoint – 80"
–Force -GACDeployment

5. 收回解决方案

从一个Web应用程序收回

$solution = Get-SPSolution
-Identity c0e31dec-294d-4f2d-9ae4-f2e637c766bd
Uninstall-SPSolution $solution –WebApplication "SharePoint – 80"

从所有Web应用程序收回

$solution = Get-SPSolution
-Identity c0e31dec-294d-4f2d-9ae4-f2e637c766bd
Uninstall-SPSolution $solution –AllWebApplications

收回全局部署的解决方案

$solution = Get-SPSolution
-Identity c0e31dec-294d-4f2d-9ae4-f2e637c766bd
Uninstall-SPSolution $solution

6. 更新解决方案

$solution = Get-SPSolution
-Identity c0e31dec-294d-4f2d-9ae4-f2e637c766bd
Update-SPSolution $solution –LiteralPath "c:\newsolution.wsp" –Force
-GACDeployment

7. 从场中移除解决方案

$solution = Get-SPSolution
 -Identity c0e31dec-294d-4f2d-9ae4-f2e637c766bd
Remove-SPSolution $solution

8. 向网站集中添加沙盒解决方案

Add-SPUserSolution –LiteralPath "c:\SBSolution.wsp" –Site
"http://intranet.sp2010.com/sites/UserSC"

9. 获取网站集中所有可用的沙盒解决方案

Get-SPUserSolution –site http://intranet.sp2010.com/sites/UserSC

10. 获取指定的沙盒解决方案

$userSolution = Get-SPUserSolution
-Identity c0e31dec-294d-4f2d-9ae4-f2e637c766bd
–site http://intranet.sp2010.com/sites/UserSC

11. 激活沙盒解决方案

$userSolution = Get-SPUserSolution
-Identity c0e31dec-294d-4f2d-9ae4-f2e637c766bd
Install-SPUserSolution $userSolution –Site 
"http://intranet.sp2010.com/sites/UserSC"

12. 反激活沙盒解决方案

$userSolution = Get-SPUserSolution
-Identity c0e31dec-294d-4f2d-9ae4-f2e637c766bd
Uninstall-SPUserSolution $userSolution –Site 
"http://intranet.sp2010.com/sites/UserSC"

13. 更新沙盒解决方案

Add-SPUserSolution –LiteralPath "c:\SBSolution2.wsp"
–Site "http://intranet.sp2010.com/sites/UserSC"
$userSolution = Get-SPUserSolution
-Identity c0e31dec-294d-4f2d-9ae4-f2e637c766bd
Update-SPUserSolution $userSolution
–site "http://intranet.sp2010.com/sites/UserSC"
–ToSolution SBSolution2

14. 移除沙盒解决方案

$userSolution = Get-SPUserSolution
-Identity c0e31dec-294d-4f2d-9ae4-f2e637c766bd
Remove-SPUserSolution $userSolution
–site http://intranet.sp2010.com/sites/UserSC

15. 显示场中的功能

Get-SPFeature –Farm

16. 显示Web应用程序中的功能

Get-SPFeature –WebApplication "SharePoint – 80"

17. 显示网站集中的功能

Get-SPFeature –Site http://sp2010

18. 显示网站中的功能

Get-SPFeature –Web http://sp2010

19. 获取指定的功能

$feature = Get-SPFeature
-Identity e8389ec7-70fd-4179-a1c4-6fcb4342d7a0

20. 激活功能

$feature = Get-SPFeature
-Identity e8389ec7-70fd-4179-a1c4-6fcb4342d7a0
Enable-SPFeature $feature –Url "http://sp2010" -Force

21. 反激活功能

$feature = Get-SPFeature
-Identity e8389ec7-70fd-4179-a1c4-6fcb4342d7a0
Disable-SPFeature $feature –Url "http://sp2010" -Force

22. 安装功能

Install-SPFeature –Path "CustomFeature" -Force

23. 卸载功能

$feature = Get-SPFeature
-Identity e8389ec7-70fd-4179-a1c4-6fcb4342d7a0
Uninstall-SPFeature $feature  -Force

24. 导出场中安装的解决方案

[Void][System.Reflection.Assembly]::LoadWithPartialName(
"Microsoft.SharePoint")
[Void][System.Reflection.Assembly]::LoadWithPartialName(
"Microsoft.SharePoint.Administration")
    $spFarm = [Microsoft.SharePoint.Administration.SPFarm]::Local
    $spFarmSolutions = $spFarm.Solutions
    $localPath = "C:\Solutions\"
    foreach($spFarmSolution in $spFarmSolutions)
    {
         [string]$outputFileName = $localPath + $spFarmSolution.Name
        $spFarmSolution.SolutionFile.SaveAs($outputFileName);
    } 
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值