Sharing the experience search

Search sharing-the-experience.blogspot.com

Friday, June 18, 2010

sharepoint custom timer job: how to execute immediatelly

Forcing the execution of timer jobs - a nice and short article how to run a custom timer job ignoring the schedule.
To be short:
1 - you can use powershell:
foreach (SPJobDefinition customJob in site.WebApplication.JobDefinitions)
{
 if(customJob.DisplayName=="{custom timer job name}")
 {
    customJob.Execute(Guid.Empty);
 }
}

2. - or use the custom solution  zevenseas Timerjob Overview .  
But I couldn't use the function "Run now" - it was "Unexpected error", but still  was able to change the schedule.


My own preference toward powershell method - less mysticism what is happening.

3. 
stsadm -o gl-runtimerjob -job "{job name}"  -url {site url}

  gl-runtimerjob - a custom stsadm command from a beautiful wsp file created by Gary Lapointe

No comments:

Post a Comment