Remove a stuck timer job in SharePoint using Powershell

I recently had a stuck timer job in our sharepoint farm.
It seemed like an easy thing for Powershell, but it turned out to be one step more complicated – I’m not sure why, but here’s the solution I used – thanks to Todd from the Vendor I was working on for providing the fix!

We can use the Cmdlet get-SPTimerJob to see all timerjobs in our sharepoint farm.

If we add a nice little where clause, we can limit the list to a single item:

Get-SPTimerJob | where {$_.name -like "Name of your stuck job"}

Normally I’ve been able to assign the results to a variable

ie like this:

$badjob = Get-SPTimerJob | where {$_.name -like "Name of your stuck job"}

Which works.
What didn’t work however was this:

$badjob.delete()

For some reason, I got an error that there was no delete method.
Weird.

So instead:

Get-SPTimerJob | where {$_.name -like "Name of your stuck job"} |fl
# I then read the ID from the output of the above (note I added | fl at the end) 
# and I copied and pasted it into this command:
$badjobTake2 = Get-SPTimerJob -ID (pasted the ID here)
$badjobTake2.Delete()  #this worked

I’m not sure what the difference is, maybe I even fat fingered it the first time..
but that’s how it got resolved.

2 thoughts on “Remove a stuck timer job in SharePoint using Powershell”

  1. Hi,

    Thank you very much for taking the time to provide us with this simple solution. I’ve experienced stuck timer jobs several times now. Thanks!

Comments are closed.