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

$LogTime = Get-Date -Format yyyy-MM-dd_hh-mm
$LogFile = ".\TimerJobReportPatch-$LogTime.rtf"
# Add SharePoint PowerShell Snapin if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null ) {
Add-PSSnapin Microsoft.SharePoint.Powershell
}
$scriptBase = split-path $SCRIPT:MyInvocation.MyCommand.Path -parent
Set-Location $scriptBase
#Deleting any .rtf files in the scriptbase location
$FindRTFFile = Get-ChildItem $scriptBase\*.* -include *.rtf
if($FindRTFFile)
{
foreach($file in $FindRTFFile)
{
remove-item $file
}
}
start-transcript $logfile
Function TimerJobReport()
{
$Output = $scriptBase + "\" + "TimerJobReport.csv";
"Name" + "," + "Status" + "," + "LastRun" + "," + "Schedule" | Out-File -Encoding Default -FilePath $Output;
write-host "Generating TimerJob generic report" -fore yellow
$TimerJobs = get-sptimerjob
foreach($TimerJob in $Timerjobs)
{
$TimerJob.name + "," + $TimerJob.status + "," + $TimerJob.lastruntime + "," + $TimerJob.schedule | Out-File -Encoding Default -Append -FilePath $Output;
}
write-host "TimerJob genric report collected and placed under " $Output -fore green
} Function TimerJobHistory()
{
$Output1 = $scriptBase + "\" + "TimerJobHistoryReport.csv";
"Name" + "," + "Status" + "," + "ServerName" + "," + "WebApplicationName" + "," + "ErrorMessage" | Out-File -Encoding Default -FilePath $Output1;
write-host "Generating TimerJob history report" -fore yellow
$TimerJobs = get-sptimerjob
foreach($TimerJob in $Timerjobs)
{
$JobHistories = $TimerJob.historyentries
foreach($Jobhistory in $JobHistories)
{
if($TimerJob.lastruntime.ToUniversalTime() -eq $JobHistory.starttime)
{
$TimerJob.Name + "," + $Jobhistory.status + "," + $Jobhistory.servername + "," + $Jobhistory.WebApplicationName + "," + $Jobhistory.ErrorMessage | Out-File -Encoding Default -Append -FilePath $Output1;
}
}
}
write-host "TimerJob history report generated and placed under " $output1 -fore green
} Function SpecificTimerJob()
{
$Output2 = $scriptBase + "\" + "SpecificTimerJobHistoryReport.csv";
"Name" + "," + "Status" + "," + "ServerName" + "," + "TimerJobStartTime" + "," + "WebApplicationName" + "," + "ErrorMessage" | Out-File -Encoding Default -FilePath $Output2;
$TimerJobName = read-host "Enter the timer job name "
$Timerjob = get-sptimerjob -identity $TimerJobName
$jobHistories = @($timerjob.historyentries)
$HowManyHistory = read-host "Please enter the number of histories that you want to return for this timerjob "
for($i = 0 ; $i -le $HowManyHistory; $i++)
{
$TimerJob.Name + "," + $jobHistories[$i].status + "," + $jobHistories[$i].servername + "," + $jobHistories[$i].StartTime + "," + $jobHistories[$i].WebApplicationName + "," + $jobHistories[$i].ErrorMessage | Out-File -Encoding Default -Append -FilePath $Output2;
}
break;
}
write-host "########################################################################################################" -fore cyan
write-host "Enter 1 to get SP Timer job generic reports" -fore green
write-host "Enter 2 to get specific SP Timer job report " -fore green
write-host "########################################################################################################" -fore cyan
$option = read-host "Enter the option "
switch($option)
{
1{
TimerJobReport
TimerJobHistory
} 2{
SpecificTimerJob
}
}
write-host "SCRIPT COMPLETED" -fore green
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. Hibernate注解

    前言: 最近正在学习Hibernate通过注解(annotation)来管理映射关系,以前都是通过XML映射文件.下面拿个小例子说一下. 数据库物理模型: 数据库的描述: 一篇博客随笔可以分到不同的类 ...

  2. ES6 - Note4:Class类

    1.Class类的介绍 在ES6中新增了Class类的概念,让语法看起来更像是面向对象编程,其实这可以说是一个语法糖,ES5可以做到Class绝大部分功能,但也有一些不同.在ES6以前,可以通过构造函 ...

  3. MySQL监控利器-Innotop

    Innotop是一款十分强大的MySQL监控工具,用perl所写,通过文本模式展示MysQL服务器和Innodb的运行状况. 安装innotop 下载地址:https://github.com/inn ...

  4. 【记录】ASP.NET MVC RegisterBundles

    1. Install the package from nuget Install-Package Microsoft.AspNet.Web.Optimization 2,BundleConfig 配 ...

  5. Deadlock Detecting--转

    /* Java Threads, 3rd Edition By Scott Oaks, Henry Wong 3rd Edition September 2004 ISBN: 0-596-00782- ...

  6. JavaWeb:EL表达式

    JavaWeb:EL表达式 说明 1.Expression Language语言,一种用于JSP文件中的数据访问的语言. 2.能够简化JSP文件中该数据访问的代码,可用来替代传统的基于<%= % ...

  7. 关于一道PHP面试题的解法

    参照一个int型数组,如int[] a1=new int[]{10,9,10,20,15,3,9,8,7,1,1},编写一个方法,要求输出不重复,且降序的拼接字符串(连接字符用逗号),如上数组,输出的 ...

  8. VS Code - Debugger for Chrome调试JavaScript的两种方式

    VS Code - Debugger for Chrome调试JavaScript的两种方式 最近由于出差的缘故,博客写的不是很多,一直想写一篇VS Code - Debugger for Chrom ...

  9. idea 自动提示生成 serialVersionUID

    from: http://tonycody.blog.51cto.com/8421818/1401422 Intellij IDEA 默认没启用这个功能. Setting->Inspection ...

  10. Sublime Text 使用介绍、全套快捷键及插件推荐

    开篇:如果说Notepad++是一款不错Code神器,那么Sublime Text应当称得上是神器滴哥.Sublime Text最大的优点就是跨平台,Mac和Windows均可完美使用:其次是强大的插 ...