Friday, October 31, 2014

Delete a Timer Job in SharePoint

I was looking for a custom timer job that was having two instances. Second instance got created after another deployment. Feature deactivation did not delete the existing job. I wanted to delete old timer job but there is not option to delete that in central Admin. PowerShell help me out on that. PowerShell’s Get-SPTimerJob command provides listing of all the timer jobs.

When I run this command it was truncating the name and ids. To see all jobs with full name we need to change the buffer Size property of PowerShell window to 250+

Get-SPTimerJob |Format-Table id,name

To narrow down the results I used where clause with name with these properties to distinguish old job.

Get-SPTimerJob | where { $_.name -like "<JobName>" }| Format-Table  -autosize -Property LastRunTime,id,name,DisplayName,Status,ErrorMessage

After finding the id of correct Job, run these commands to delete the job.


$job = Get-SPTimerJob -id <Job's GUID>
$job.Delete()

Job will be deleted. you can confirm running above Get-SPTimerJob PowerShell command or in CA. 

No comments:

Post a Comment