1. Get Timer Job internal name with id.

Job ID can be found in SharePoint CA.

Below PowerShell can help you retrieve all jobs’ Internal Name by keywords.

Get-SPTimerJob | Sort-Object name | where {$_.Name -like "*Profile*"} | ft id,name

2. Using script in attachment, you can get the history of specific Timer Job

The result will be like this.

PowerShell

  1. $LogTime = Get-Date -Format yyyy-MM-dd_hh-mm
  2. $LogFile = ".\TimerJobReportPatch-$LogTime.rtf"
  3. # Add SharePoint PowerShell Snapin
  4.  
  5. if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null ) {
  6. Add-PSSnapin Microsoft.SharePoint.Powershell
  7. }
  8. $scriptBase = split-path $SCRIPT:MyInvocation.MyCommand.Path -parent
  9. Set-Location $scriptBase
  10. #Deleting any .rtf files in the scriptbase location
  11. $FindRTFFile = Get-ChildItem $scriptBase\*.* -include *.rtf
  12. if($FindRTFFile)
  13. {
  14. foreach($file in $FindRTFFile)
  15. {
  16. remove-item $file
  17. }
  18. }
  19. start-transcript $logfile
  20. Function TimerJobReport()
  21. {
  22. $Output = $scriptBase + "\" + "TimerJobReport.csv";
  23. "Name" + "," + "Status" + "," + "LastRun" + "," + "Schedule" | Out-File -Encoding Default -FilePath $Output;
  24. write-host "Generating TimerJob generic report" -fore yellow
  25. $TimerJobs = get-sptimerjob
  26. foreach($TimerJob in $Timerjobs)
  27. {
  28. $TimerJob.name + "," + $TimerJob.status + "," + $TimerJob.lastruntime + "," + $TimerJob.schedule | Out-File -Encoding Default -Append -FilePath $Output;
  29. }
  30. write-host "TimerJob genric report collected and placed under " $Output -fore green
  31. }
  32.  
  33. Function TimerJobHistory()
  34. {
  35. $Output1 = $scriptBase + "\" + "TimerJobHistoryReport.csv";
  36. "Name" + "," + "Status" + "," + "ServerName" + "," + "WebApplicationName" + "," + "ErrorMessage" | Out-File -Encoding Default -FilePath $Output1;
  37. write-host "Generating TimerJob history report" -fore yellow
  38. $TimerJobs = get-sptimerjob
  39. foreach($TimerJob in $Timerjobs)
  40. {
  41. $JobHistories = $TimerJob.historyentries
  42. foreach($Jobhistory in $JobHistories)
  43. {
  44. if($TimerJob.lastruntime.ToUniversalTime() -eq $JobHistory.starttime)
  45. {
  46. $TimerJob.Name + "," + $Jobhistory.status + "," + $Jobhistory.servername + "," + $Jobhistory.WebApplicationName + "," + $Jobhistory.ErrorMessage | Out-File -Encoding Default -Append -FilePath $Output1;
  47. }
  48. }
  49. }
  50. write-host "TimerJob history report generated and placed under " $output1 -fore green
  51. }
  52.  
  53. Function SpecificTimerJob()
  54. {
  55. $Output2 = $scriptBase + "\" + "SpecificTimerJobHistoryReport.csv";
  56. "Name" + "," + "Status" + "," + "ServerName" + "," + "TimerJobStartTime" + "," + "WebApplicationName" + "," + "ErrorMessage" | Out-File -Encoding Default -FilePath $Output2;
  57. $TimerJobName = read-host "Enter the timer job name "
  58. $Timerjob = get-sptimerjob -identity $TimerJobName
  59. $jobHistories = @($timerjob.historyentries)
  60. $HowManyHistory = read-host "Please enter the number of histories that you want to return for this timerjob "
  61. for($i = 0 ; $i -le $HowManyHistory; $i++)
  62. {
  63. $TimerJob.Name + "," + $jobHistories[$i].status + "," + $jobHistories[$i].servername + "," + $jobHistories[$i].StartTime + "," + $jobHistories[$i].WebApplicationName + "," + $jobHistories[$i].ErrorMessage | Out-File -Encoding Default -Append -FilePath $Output2;
  64. }
  65. break;
  66. }
  67. write-host "########################################################################################################" -fore cyan
  68. write-host "Enter 1 to get SP Timer job generic reports" -fore green
  69. write-host "Enter 2 to get specific SP Timer job report " -fore green
  70. write-host "########################################################################################################" -fore cyan
  71. $option = read-host "Enter the option "
  72. switch($option)
  73. {
  74. 1{
  75. TimerJobReport
  76. TimerJobHistory
  77. }
  78.  
  79. 2{
  80. SpecificTimerJob
  81. }
  82. }
  83. write-host "SCRIPT COMPLETED" -fore green
  84. stop-transcript

How to get Timer Job History的更多相关文章

  1. 如何收缩超大的SharePoint_Config数据库

    前言 在已经运行了2年多的SharePoint服务器上,发现SharePoint_Config的数据库文件越来越大,已经达到90几个GB,收缩可以减小20几个GB,但是一周以后又会恢复到90几个GB大 ...

  2. 怎样收缩超大的SharePoint_Config数据库

    前言 在已经执行了2年多的SharePointserver上,发现SharePoint_Config的数据库文件越来越大,已经达到90几个GB,收缩能够减小20几个GB,可是一周以后又会恢复到90几个 ...

  3. Azure WebJob-Custom Schedule for Azure Web Job Timer Triggers

    如果想实现Azure Schedule WebJob,有两种方法: 1. 配置CRON Expression,网上有在线CRON配置工具,根据业务需要配置即可 注意:Azure的CRON Expres ...

  4. JavaScript(JS)之Javascript对象BOM,History,Location,Function...(二)

    https://www.cnblogs.com/haiyan123/p/7594046.html 在JavaScript中除了null和undefined以外其他的数据类型都被定义成了对象,也可以用创 ...

  5. JS BOM基础 全局对象 window location history screen navigator

    全局变量声明的两种方式:1,window.变量名=值;2,var 变量名=值; 全局函数声明的两种方式:1,window.函数名=function(){}2,function 函数名=function ...

  6. History API与浏览器历史堆栈管理

    移动端开发在某些场景中有着特殊需求,如为了提高用户体验和加快响应速度,常常在部分工程采用SPA架构.传统的单页应用基于url的hash值进行路由,这种实现不存在兼容性问题,但是缺点也有--针对不支持o ...

  7. 使用backbone的history管理SPA应用的url

    本文介绍如何使用backbone的history模块实现SPA应用里面的URL管理.SPA应用的核心在于使用无刷新的方式更改url,从而引发页面内容的改变.从实现上来看,url的管理和页面内容的管理是 ...

  8. 使用h5的history改善ajax列表请求体验

    信息比较丰富的网站通常会以分页显示,在点“下一页”时,很多网站都采用了动态请求的方式,避免页面刷新.虽然大家都是ajax,但是从一些小的细节还是 可以区分优劣.一个小的细节是能否支持浏览器“后退”和“ ...

  9. HTML5学习笔记之History API

    这系列文章主要是学习Html5相关的知识点,以学习API知识点为入口,由浅入深的引入实例,让大家一步一步的体会"h5"能够做什么,以及在实际项目中如何去合理的运用达到使用自如,完美 ...

随机推荐

  1. jQuery2.0.3源码分析系列之(29) 窗口尺寸

    .height() .innerHeight() .innerWidth() .outerHeight() .outerWidth() .width() 基础回顾 一般的,在获取浏览器窗口的大小和位置 ...

  2. 推荐21款最佳 HTML5 网页游戏

    尽管 HTML5 的完全实现还有很长的路要走,但 HTML5 正在改变 Web,未来 HTML5 将把 Web 带入一个更加成熟和开放的应用平台.现在,越来越多的人尝试用 HTML5 来制作网页游戏等 ...

  3. IDDD 实现领域驱动设计-一个简单的 CQRS 示例

    上一篇:<IDDD 实现领域驱动设计-CQRS(命令查询职责分离)和 EDA(事件驱动架构)> 学习架构知识,需要有一些功底和经验,要不然你会和我一样吃力,CQRS.EDA.ES.Saga ...

  4. geotrellis使用(十五)使用Bokeh进行栅格数据可视化统计

    Geotrellis系列文章链接地址http://www.cnblogs.com/shoufengwei/p/5619419.html 目录 前言 实现方案 总结 一.前言        之前有篇文章 ...

  5. Swift - 重写UIKit框架类的init初始化方法(以UITabBarController为例)

    原来写了篇文章讲UITabBarController的用法,当时是从UIViewController跳转到UITabBarController页面,代码如下: 1 self.presentViewCo ...

  6. EXP/IMP迁移案例,IMP遭遇导入表的表空间归属问题

    生产环境: 源数据库:Windows Server + Oracle 11.2.0.1 目标数据库:SunOS + Oracle 11.2.0.3 1.确认迁移需求:源数据库cssf 用户所有表和数据 ...

  7. jQuery 插件为什么要return this.each()

    jQuery.fn.test2= function(){ this.css("background","#ff0");//这里面的this为jquery对象,而 ...

  8. 通过寄生组合式继承创建js的异常类

    最近项目中在做js的统一的异常处理,需要自定义异常类.理想的设计方案为:自定义一个异常错误类BaseError,继承自Error,然后再自定义若干个系统异常,例如用户取消异常.表单异常.网络异常,这些 ...

  9. 8.2 使用Fluent API进行实体映射【Code-First系列】

    现在,我们来学习怎么使用Fluent API来配置实体. 一.配置默认的数据表Schema Student实体 using System; using System.Collections.Gener ...

  10. Not a git repository (or any of the parent directories): .git

    今天准备在win10上面安装git,想把代码发布到github中,按照教程的方法一步一步下来,当配置完ssh和用户名,邮箱之后,发现下拉不下来github中的代码,出现如下错误. 说是没有发现仓储,很 ...