views:

1224

answers:

1

I'd like to invoke a timer job installed on a SharePoint server manually. What would be useful is something along the lines of an stsadm command.

My scenario is, I've deployed a solution with a bunch of features to a customers server. I don't want to wait for the weekly schedule to kick a particular timer job to life. I would like to just punch in a command to get the specific job to run immediately. Obviously in the development enviroment I've got the schedule set for a few minutes but I want to do a test run while I'm on site with the customer.

+3  A: 

You can develop a custom command line based tool that gets the job's SPJobDefiniton based on the criteria that identifies your job from the service.JobDefinitions collection. From there you can execute it using the Execute() method.

Magnus Johansson
If you want to take it one step further you can turn the command line tool into a stsadm extension. Here is how you do it: http://sharepointsolutions.blogspot.com/2006/09/extending-stsadmexe-with-custom.html
JMD