SharePoint自动化系列——Content Type相关timer jobs一键执行
转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/
背景:
在SharePoint Central Administration->Monitoring->Job Definitions中我们可以看到所有的timer jobs,其中和Content Type相关的timer jobs有:
1.Content Type Hub
2.Content Type Sucscriber(job definition的数量等于于web application的数量)
原因:
由于在web application数量较多的时候,我们在publish一个content type后要将以上所有的job都跑一遍,在UI界面上操作是非常麻烦的!而且容易重复跑或没跑到。所以需要一段脚本来自动执行所有的和content type相关的jobs,脚本内容如下:
#Start the SharePoint content type relative jobs.
Add-PSSnapin Microsoft.SharePoint.PowerShell
$ContentTypeHubJob = Get-SPTimerJob|where{$_.name -like '*MetadataHubTimerJob*'}
$ContentTypeSubscriberJobs = Get-SPTimerJob|where{$_.name -like '*MetadataSubscriberTimerJob*'}
Start-SPTimerJob $ContentTypeHubJob
foreach($job in $ContentTypeSubscriberJobs)
{
Start-SPTimerJob $job
}
$tip = "'Content Type Hub' job's LastRunTime is: " + $ContentTypeHubJob.LastRunTime
Write-Host $tip -ForegroundColor Green
for($i=0;$i -lt $ContentTypeSubscriberJobs.count;$i++)
{
$tip = "'Content Type Subscriber' job" + ($i+1) + "'s LastRunTime is: " + $ContentTypeSubscriberJobs[$i].LastRunTime
Write-Host $tip -ForegroundColor Green
}
Read-Host
将以上内容保存到ps1类型文件中,右键点击“Run with PowerShell”执行:
运行结果如下:
SharePoint自动化系列——Content Type相关timer jobs一键执行的更多相关文章
- SharePoint自动化系列——Add content type to list.
转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 将创建好的content type(若是跨web application需要事先publish c ...
- SharePoint自动化系列——Error features自动deactivate
转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ SharePoint Content Deployment prerequisite——Error ...
- SharePoint自动化系列——Add/Remove “Hold” from items
转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 问题1: 1.如果SharePoint item被添加了hold,通过UI界面来对SharePoi ...
- SharePoint自动化系列——Site/Web/List级别的导航菜单
转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 需求:在不同的测试用例中,对脚本中不确定的因素需要和用户交互来确定,比如选择哪个site,选择哪个 ...
- SharePoint自动化系列——通过Coded UI录制脚本自动化创建SharePoint Designer Reusable Workflow
Coded UI非常好,我开始还在想,怎么样能让一个通过SharePoint Designer创建的Workflow publish三百五十次?想不到一个好的方法,也不知道SharePoint Des ...
- SharePoint自动化系列——创建MMS terms
转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ PowerShell脚本实现MMS group.termSet.terms的自动化创建: Add- ...
- SharePoint自动化系列——Manage "Site Subscriptions" using PowerShell
转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 你可以将普通的sites加入到你的site subscriptions中,前提是你需要有一个 Te ...
- SharePoint自动化系列——通过PowerShell创建SharePoint Site Collection
通过PowerShell创建SharePoint Site Collection,代码如下: Add-PSSnapin microsoft.sharepoint.powershell function ...
- SharePoint自动化系列——Solution auto-redeploy using Selenium(C#)
转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 本来的想法是做一个可以自动卸载并且部署新solution到SharePoint farm的tool ...
随机推荐
- MySQL单表最大限制
想把一个项目的数据库导出来,然后倒入到自己熟悉的MySQL数据库中进行运行和调试.导出来后,发现sql文件整整有12G多大,忽然想起来,MySQL好像有个叫做容量限制的神奇特性,但是忘了上限是多少了, ...
- nyist 518 取球游戏
http://acm.nyist.net/JudgeOnline/problem.php?pid=518 取球游戏 时间限制:1000 ms | 内存限制:65535 KB 难度:2 描述 今 ...
- ACM常用算法及练习(2)
ACM常用算法及练习 知识类型 重要度 容易度 应掌握度 典型题 其他 数据结构(5) 链表 ★★☆ ★★★ ★★☆ 栈 stack ★★★ ★★★ ★★★ HLoj120 ...
- fread与fwrite的自我理解
size_t fread(void* buff,size_t size,size_t count,FILE* stream) 参数1:读取到该buff所指向的内存空间中 参数2:每次读取的字节数,单 ...
- PTPX的average power analysis
在average power analysis中,switching activity被分解为toggle rate和static probabilities两部分. annotation的sourc ...
- switch结构2016/03/08
Switch 03/08 一.结构 switch(){ case *: ;break;……default: ;brek;} 练习:输入一个日期,判断这一年第几天? Console.Write(&q ...
- Hadoop之TaskAttemptContext类和TaskAttemptID类
先来看看TaskAttemptContext的类图 : Figure1:TaskAttemptContext类图 用户向Hadoop提交Job(作业),Job在JobTracker对象的控制下执行.J ...
- 想学习一下CSS函数
好像原来都是用前后端代码实现的功能,如今CSS3已经吸纳为标准,使用简单的选择器就可以实现了.
- android 学习随笔十六(广播 )
1.广播接收者 BroadcastReceiver 接收系统发出的广播 现实中的广播:电台为了传达一些消息,而发送的广播,通过广播携带要传达的消息,群众只要买一个收音机,就可以收到广播了 Andro ...
- 设置Tab键为四个空格
https://my.oschina.net/xunxun10/blog/110074