# Get current date
$date = Get-Date
# Show current date
Write-Host "Looking
for running jobs with a Last Run Time of greater than or equal to" $date
# Get all Timer jobs and
iterate
Get-SPTimerJob |
ForEach-Object {
# Get last run time for job
$lastRunTime = $_.LastRunTime
# If run time is greater than/equal to write
it out
if ($lastRunTime -ge $date)
{
Write-Host $_.Name", last run
at" $_.LastRunTime
}
}
If you want to include a bit of history,
like number of jobs run in the last five minutes, just use this for your $date
variable:
$date = (Get-Date).AddMinutes(-5)
No comments:
Post a Comment