Wednesday, May 29, 2013

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.



You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Check out these SharePoint products:

No comments :

Post a Comment

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...