转载请注明出自天外归云的博客园: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一键执行的更多相关文章

  1. SharePoint自动化系列——Add content type to list.

    转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 将创建好的content type(若是跨web application需要事先publish c ...

  2. SharePoint自动化系列——Error features自动deactivate

    转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ SharePoint Content Deployment prerequisite——Error ...

  3. SharePoint自动化系列——Add/Remove “Hold” from items

    转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 问题1: 1.如果SharePoint item被添加了hold,通过UI界面来对SharePoi ...

  4. SharePoint自动化系列——Site/Web/List级别的导航菜单

    转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 需求:在不同的测试用例中,对脚本中不确定的因素需要和用户交互来确定,比如选择哪个site,选择哪个 ...

  5. SharePoint自动化系列——通过Coded UI录制脚本自动化创建SharePoint Designer Reusable Workflow

    Coded UI非常好,我开始还在想,怎么样能让一个通过SharePoint Designer创建的Workflow publish三百五十次?想不到一个好的方法,也不知道SharePoint Des ...

  6. SharePoint自动化系列——创建MMS terms

    转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ PowerShell脚本实现MMS group.termSet.terms的自动化创建: Add- ...

  7. SharePoint自动化系列——Manage "Site Subscriptions" using PowerShell

    转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 你可以将普通的sites加入到你的site subscriptions中,前提是你需要有一个 Te ...

  8. SharePoint自动化系列——通过PowerShell创建SharePoint Site Collection

    通过PowerShell创建SharePoint Site Collection,代码如下: Add-PSSnapin microsoft.sharepoint.powershell function ...

  9. SharePoint自动化系列——Solution auto-redeploy using Selenium(C#)

    转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 本来的想法是做一个可以自动卸载并且部署新solution到SharePoint farm的tool ...

随机推荐

  1. zabbix监控windows主机网卡流量

    监控windows主机网卡流量 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任.     欢迎加入:高级运维工程师之路 598432640 客户端配置:(172.30.1.120,wi ...

  2. python2.7使用ansible

    升级python到2.7后 $ ansible 报错 Traceback (most recent call last): File "/usr/bin/ansible", lin ...

  3. kafka监控工具kafkaOffsetMoniter的使用

    简介 KafkaOffsetMonitor是由Kafka开源社区提供的一款Web管理界面,用来实时监控Kafka的Consumer以及Partition中的Offset,可以在web界面直观的看到每个 ...

  4. MVC4 下DropDownList使用方法

    与MVC3相比,差别很大: 表现形式一: public ActionResult Main() { List<SelectListItem> items = new List<Sel ...

  5. sql set xact_abort on 用例

    set xact_abort on 设置事务回滚的当为ON时,如果你存储中的某个地方出了问题,整个事务中的语句都会回滚为OFF时,只回滚错误的地方 例子 : ALTER proc [dbo].[BuC ...

  6. PAT乙级 1006. 换个格式输出整数 (15)

    1006. 换个格式输出整数 (15) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue 让我们用字母B来表示“百” ...

  7. HTML输入框点击内容消失

    在input标签中这样写 type='text' onfocus='if(this.value=='请输入内容以搜索') this.value=''' onblur='if(this.value==' ...

  8. 图像处理之常用颜色RGB、灰度值

    128/0/0       深红         255/0/0       红           255/0/255     粉红        255/153/204 玫瑰红       153 ...

  9. Left Join 与Right Join 与 Inner Join 与 Full Join的区别

    首先看看Left Join 与Right Join 与 Inner Join 与 Full Join对表进行操作后得到的结果. 在数据库中新建两张表,并插入要测试的数据. 新建表: USE [Test ...

  10. Ul li 横排 菜单

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...