首页 > 代码库 > powershell 操作sharepoint命令集

powershell 操作sharepoint命令集

打开SharePoint 2013 Management Shell, and then run as administrator.执行如下命令

1. 添加wsp和安装
Add-SPSolution -LiteralPath "C:\DeployResource\WSP\test.wsp"
Install-SPSolution -Identity "test.wsp" -WebApplication "http://domain:port/" -GACDeployment -Force

如果是无资源安装则去掉-WebApplication "http://domain:port/"

2. 更新wsp:Update-SPSolution -Identity SPListUpdateAD.wsp -LiteralPath "D:\BackupOfBackup\Release_20141010\WSP\SPListUpdateAD.wsp" -GACDeployment

3. 备份wsp:Get-SPSolution | Where {$_.Name -eq "SPListUpdateAD.wsp" } | ForEach-Object{ $_.SolutionFile.SaveAs("d:\Backwsp\"+$_.Name)}

4. 移除wsp,需要先在CA>System Settings>farm solution>retract 该wsp,在执行下面powershell script
Remove-SPSolution -Identity "hkexsitewakeuptimerjob.wsp" -Confirm:$false

5. 移除timer job

$job = Get-SPTimerJob -id 3219759c-c748-444c-9ed7-bb3afb17fc9f
$job.Delete()

6. 查询timer job
Get-SPTimerJob | where { $_.name -like “*HKEx*” } |ft id,name

7. 激活feature
Enable-SPFeature -Identity "SharePointWebPartProject_SharePointWebPartFeature" -Url http://www.contoso.com
8. 禁用feature
disable-SPFeature -id 1563deb1-0c37-481c-9463-f3581e720897 -Url http://www.contoso.com  -Url http://www.contoso.com

 

powershell 操作sharepoint命令集