This is something that's been bugging me for a long time - when you run the out of the box execadmsvcjobs command on a server it only ensures that pending jobs on that one server are executed - when it completes it doesn't mean that jobs on other servers in the farm have completed. This gets real annoying when you are using a script to deploy solution because end up getting errors about pending timer jobs needing to complete.
I tried a couple of different approaches to address this problem - the first was to use WMI to execute the execadmsvcjobs command remotely on each server. Problem with this approach is that for some reason the security context kept getting to changed to "NT AUTHORITY\ANONYMOUS LOGON" even though the process showed that it was running as my executing account - never figured out what the heck was going on with that so I decided to try a different approach. The next thing I tried was to reverse engineer the out of the box command and change it to execute all jobs for each server, not just the local server. This appeared to work but upon further inspection it became clear that it wasn't working at all - there's definitely something going on that gets whacked out when executing this way - so I was left with trying to find another approach.
What I eventually ended up with was a simple command that leveraged what I had done while trying to recreate the out of the box execadmsvcjobs command but instead of executing the job on each server it simply blocks until the jobs have all completed. It's not exactly what I wanted but the end result is the same - the command blocks my script until the pending jobs have finished on each server thus allowing my subsequent commands to run without error. The name of this new command is gl-execadmsvcjobs.
The help for the command is shown below:
C:\>stsadm -help gl-execadmsvcjobs stsadm -o gl-execadmsvcjobs Executes pending timer jobs on all servers in the farm. Parameters: [-local]
The following table summarizes the command and its various parameters:
|Command Name||Availability||Build Date|
|gl-execadmsvcjobs||WSS v3, MOSS 2007||Released: 10/25/2008
|Parameter Name||Short Form||Required||Description||Example Usage|
|local||l||No||If passed in then do not consider other servers in the farm - this basically just treats the command exactly as the out of the box execadmsvcjobs command (in fact it just calls out to that command).||-local
The following is an example of how to make sure that all pending timer jobs have run on all servers in the farm:
stsadm -o gl-execadmsvcjobs