Since we wrote this script it has helped us get info about specific jobs really quickly. You can download this script here: SharePoint 2010 – Get Job History or copy it here:


cls
$test = Get-SPWebApplication "http://intranet/"
$myStartTime = "9/29/2011 12:30:00 AM"
$myStopTime = "9/29/2011 3:30:00 AM"


#GET ALL BETWEEN THAT TIME PERIOD
Write-Host "Fetching all jobs to JobHistoryOutput.csv for $myStartTime - $myStopTime..." -ForeGroundColor Red
$test.JobHistoryEntries | Where-Object {($_.StartTime -gt $myStartTime) -and ($_.StartTime -lt $myStopTime)} | Export-Csv JobHistoryOutput.csv –NoType
Write-Host "Done! Check JobHistoryOutput.csv for info." -ForeGroundColor Green


#GET ALL THAT FAILED BETWEEN THAT TIME PERIOD
Write-Host "Fetching all errors to JobHistoryOutputErrors.csv for $myStartTime - $myStopTime..." -ForeGroundColor Red
$test.JobHistoryEntries | Where-Object {($_.StartTime -gt $myStartTime) -and ($_.StartTime -lt $myStopTime) -and ($_.Status -ne 'Succeeded')} | Export-Csv JobHistoryOutputErrors.csv –NoType
Write-Host "Done! Check JobHistoryOutputErrors.csv for info." -ForeGroundColor Green



Retreiving SharePoint 2010 Jobs Details by Date and Time
1. Log onto your SharePoint 2010 application server with farm admin rights.
2. Run SharePoint Admin Shell.
3. Change the SharePoint application in the script on line 2 (mine was http://intranet). Change the dates and times in the scriptlines 3 and 4.
4. Run the script as shown below:

5. View output from the script:

6. You’ll get two files. C:\JobHistoryOutput.csv is all jobs. C:\JobHistoryOutputErrors.csv is jobs that didn’t get a “Succeeded” status. Sort and filter in excel for the results you want: JobDefinitionId, JobDefinitionTitle, WebApplicationId, WebApplicationName, ServiceId, ServerId, ServerName, Status, StartTime, EndTime, DatabaseName, ErrorMessage