Timer Jobs Stuck in Running Queue

If you have one or more timer jobs stuck in the “Running” queue after removing a SharePoint server from the farm, you can either let 7 days pass and they will be removed automatically, or force the removal via PowerShell:

$job = Get-SPTimerJob | where {$_.Name -eq "job-delete-job-history"}
$job.DaysToKeepHistory = 0 #or a value of your choosing, by default this is 7

Use $job.LastRunTime to check the status of the job for completion. Once the job has completed, given the timer jobs from the defunct SharePoint server are older than the DaysToKeepHistory value, the jobs will be cleaned up (along with the history for all previous valid jobs).

To reset the value for this job, run:

$job = Get-SPTimerJob | where {$_.Name -eq "job-delete-job-history"}
$job.DaysToKeepHistory = 7

Trevor Seward is a Microsoft Office Apps and Services MVP who specializes in SharePoint Server administration, hybrid scenarios, and SharePoint Online. He has been working with SharePoint for 16 years from SharePoint 2003 on up, managing environments with terabytes of content for 150,000+ user organizations. Trevor is an author of Deploying SharePoint 2016 and Deploying SharePoint 2019. You can find him on Twitter and in /r/sharepoint.