Check Running Timerjob Status using Powershell

Check the status of timer jobs that have been run by using Windows PowerShell.

$Job = Get-SPTimerjob "TimerJob Name"
[Array] $JobHistoryList=$Job.HistoryEntries
Start-SPTimerJob $Job
Write-Host "Running Timer Job" -NoNewline
$count = $JobHistoryList.count
$countNext = $count+1

while ( $countNext -ne $count)
{
[Array] $JobHistoryList=$Job.HistoryEntries
$count = $JobHistoryList.count
Write-Host "." -NoNewline
sleep 2
}

if ($taxonomyjob[0].status –ne "Succeeded")
{
Write-Host -f yellow $JobHistoryList[0].status
Write-Host -f yellow $JobHistoryList[0].ErrorMessage
}
else
{
Write-Host $JobHistoryList[0].status

}

Comments

Popular posts from this blog

Adding Contact Selector Control to InfoPath form

Adding Validation to a Custom NewForm.aspx in SharePoint & Redirect

How to add to Sub-Sub Menu in SharePoint