Tip #42. How to delete timer job

Rate this item
(0 votes)

SharePoint provides you OOTB features to run something on regular basis using "timer jobs". You can create you own custom job and SharePoint will handle it using OWSTIMER.exe. There are several resources (1, 2, 3) describing how to create and deploy you custom timer jobs.

Unfortunately, SharePoint doesn't provide tools to delete custom timer jobs via Central Administration - you can only disable it, or delete via API - SPJobDefinition.Delete() (sample) There is a codeplex project that install Central Administration extension, to manage the timer jobs, including deletion, but it doesn't help you to script you actions.

Surprisingly, Microsoft provided "undocumented" parameter of STSADM that allows you delete timer job.

stsadm.exe -o deleteconfigurationobject -id <objectID> 

The only issue is getting the Object ID for you timer job. To get this ID follow the next steps:

  1. Go to Central Administration, find you job and hover mouse over the job name
  2. Copy timer's shortcut and insert it into notepad (you get something like http://myserver:25435/_admin/JobEdit.aspx?JobId=bf166029%2D7c99%2D49cc%2D9ade%2D)
  3. Replace "%2D" on dash sign ("-") in JobID.
  4. Use stsadm.exe -o deleteconfigurationobject -id <your id>

This will remove your timer job.

Take into account that this is undocumented feature - nobody guarantee it works successfully and don't harm your environment.

Source

Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.