kwizcom banner advertisement

How to Delete a Timer Job in SharePoint using PowerShell?

But wait! why do we delete a Timer Job in SharePoint? Well, because:
  • Your custom timer job may be in stuck state
  • You may have orphaned Timer jobs (Timer job without "Server" from Timer job status page in Central Admin)
  • Your custom timer job may have created more than one instances (duplicate timer job)
In my case, a custom timer job deployed in our SharePoint 2013 environment had a bug and left two instances of the same timer job. so we wanted to delete that.

Delete a Custom Timer Job in SharePoint
There is no Central Admin UI to delete timer jobs in SharePoint. So, lets seek help from PowerShell to delete a timer job in SharePoint.
how to delete sharepoint timer job using powershell

How to Delete a Timer Job in SharePoint using PowerShell?
  • Step 1: Obtain the GUID of your target timer job to delete
    Get-SPTimerJob | where { $_.name -like "YOUR-Timer-Job-Name" } | Format-Table  -autosize -Property LastRunTime,id,name,DisplayName,Status
  • Step 2: Get the timer job and delete
    Once you obtained the GUID of your timer job to delete, Run this PowerShell cmdlets:
    $Timerjob = Get-SPTimerJob -id <Timer Job's GUID>
    
    $Timerjob.Delete()
This PowerShell script removes the given SharePoint timer job!
Do not delete any OOTB timer job unless you are very sure what you are doing! If you delete any SharePoint's critical timer jobs, You'll end up re-provisioning SharePoint on the server again.

Lesson Learnt: Developers - Make sure your Feature deactivation module contains code to delete your custom timer job in SharePoint.
How to Delete a Timer Job in SharePoint using PowerShell? How to Delete a Timer Job in SharePoint using PowerShell? Reviewed by Salaudeen Rajack on 2:45 PM Rating: 5

2 comments:

  1. How to find the GUID of the timer job?

    ReplyDelete
    Replies
    1. E.g. use: Get-SPTimerJob | where { $_.Title -like "Audit Log Trimming" } | Select ID, WebApplication, Service

      Delete

Please Login and comment to get your questions answered!

Powered by Blogger.