四度空间

专注.NET、SharePoint

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);
    } 

posted on 2013-06-30 15:37  月飘冥  阅读(150)  评论(0编辑  收藏  举报

导航