Quantcast
Channel: and so it begins…..
Viewing all articles
Browse latest Browse all 55

Retrieve timer job history for a specified time range using PowerShell

$
0
0

 

 

# Retrieve timer job history for a specified time range

# Initial settings
$Wa
= Get-SPWebApplication "
http://WebAppUrl"    # Supply the web app url here
$From= "2/13/2013 12:00:00 AM
# mm/dd/yyyy hh:mm:ss
$To = "2/14/2013 12:00:00 AM"

# Retrieve all jobs in the time range
Write-Host"Listing all timer jobs that have run between $From to $To and storing it in CSV format" -ForeGroundColor
Blue
$Wa.JobHistoryEntries | Where-Object {($_.StartTime -gt$From) -and ($_.StartTime -lt$To)} | Export-CsvTimerJobHistory.csv–NoType

Write-Host"Done.." -ForeGroundColor Green

# Retrieve all failed jobs in the time range
Write-Host"Listing all timer jobs that have failed to run between $From to $To and storing it in CSV format" -ForeGroundColor Red
$Wa.JobHistoryEntries | Where-Object {($_.StartTime -gt$From) -and ($_.To -lt$To) -and ($_.Status -ne 'Succeeded')} | Export-CsvFailedTimerJobHistory.csv–NoType

Write-Host "Done.." -ForeGroundColor Green

 


Viewing all articles
Browse latest Browse all 55

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>