SharePoint Server 2010: Timer Jobs not Functioning After Applying Updates


[Updated 10/28/2011]: Changing the title of the post . This problem affects several areas of the product, not just profile synchronization

Overview

I recently came across a nasty case where the user profile synchronization service just won’t start. Additionally, the one-time timer jobs that are created as a result of certain administrative operations were not getting deleted.  The problem started happening after the SharePoint environment was patched and upgraded with a cumulative update.  It all boiled down to the timer service instance object on some of the servers being in an Offline state (even though the Windows Timer Service was started).  Here are the details of the problem and the solution:

Note: User Profile Synchronization service can fail to start in several different scenarios, this post talks about the scenario where the timer service instance object is left in an Offline state on one or more servers, which is likely to happen after an upgrade. The Power Shell commands provided in the article below can help you confirm whether or not you’re running into the problem of offline timer service instance.

The Timer Service Instance Object (SPTimerServiceInstance)

Every SharePoint server has one SPTimerServiceInstance object which basically represents the SPTimerV4 Windows Service. In certain circumstances (typically after an upgrade), you could end up in a situation where your timer service is running on the server but the SPTimerSericeInstance object is not Online. In this case, any administrative operations that depend on timer jobs to be completed  (such as starting the User Profile Synchronization Service) will not be successful.

Finding and Resolving the Problem

I have put together a PowerShell script that can be run on any SharePoint server in the farm. The script detects SPTimerServiceInstance objects in the farm that are not online, and attempts to update their status to Online.  After running the script, please manually restart the SPTimerV4 Windows Service (SharePoint 2010 Timer) on each server that is identified to have the problem.

$farm  = Get-SPFarm
$disabledTimers = $farm.TimerService.Instances | where {$_.Status -ne "Online"}
if ($disabledTimers -ne $null)
{
    foreach ($timer in $disabledTimers)
    {
        Write-Host "Timer service instance on server " $timer.Server.Name " is not Online. Current status:" $timer.Status
        Write-Host "Attempting to set the status of the service instance to online"
        $timer.Status = [Microsoft.SharePoint.Administration.SPObjectStatus]::Online
        $timer.Update()
    }
}
else
{
    Write-Host "All Timer Service Instances in the farm are online! No problems found"
}

Hope you find this useful!

Happy SharePointing!


Comments (11)

  1. Rakesh says:

    Awesome, it worked like a charm for me, Thanks a lot Tehnoon.

  2. Rakesh says:

    Awesome, it worked like a charm for me, Thanks a lot Tehnoon.

  3. Binu says:

    Can we use :

     $timer.Status = "Online"

    instead of :

     $timer.Status = [Microsoft.SharePoint.Administration.SPObjectStatus]::Online

    – and still get the same result?

  4. Aswath says:

    you cannot use $timer.Status = "Online" as it is  nto string its stype of Administration.SPObjectStatus enum you need to type cast

  5. Chilly says:

    Say I have a server that went offline and I have 5 timer jobs stuck associated with that server.  How would I stop those Stuck running jobs?

  6. sharepoint says:

    awesome

  7. Hi Chilly,

    If you have completely lost the server, you should go to the "Servers in Farm" page from central administration web site and remove the server from the farm. This should also remove the timer jobs.

  8. KH says:

    Thank you! I ran into this very issue on one of my app servers after apply the September 2014 CU to my 2013 farm. The timer service appeared to be running under services but some of my jobs, like the nightly spproduct versioning job, wasn't running.

  9. Nilldot says:

    Thank you!

    Time service was running and I could even restart it, but no schedules jobs were running.

    You code did the job!

  10. AdrianR says:

    I had problems in SP2013 when updating the farm service account credentials, with the credentials not being pushed out to all application pools and services. This script fixed the problems.

    Thank you!

  11. Xeeshan Tahir says:

    Thank You Tehnoon. It was a life saver. I owe you a dinner when you’ll return Lahore.

Skip to main content