I created this particular command because I needed to get some additional information about service level timer jobs. If you go to Central Admin -> Operations -> Time Job Definitions (or status) you'll see all the timer jobs for the farm. This includes those associated with a particular web application and a service. I already had a command to get all the jobs for a web app (GetJobInfos) however this command didn't give me all the information I was looking for (and I did not author this command so I wanted to keep changes to it minimal though in the end I did end up having to modify it slightly).
So this command, gl-enumtimerjobdefinitions, won't be entirely useful to most people - I'm just outputting more information than the other and the results are in XML rather than flat text (I suppose if someone wanted to consume the XML output then you could do other programmatic things with that).
The code for this is pretty simplistic. I've got two primary methods which take care of adding either a service's jobs or a web app's jobs and then a third which determines which of the other two should be called. There's also a fourth method which just takes a job and produces the XML nodes for that job. The core code is shown below:
The syntax of the command can be seen below:
C:\>stsadm -help gl-enumtimerjobdefinitions stsadm -o gl-enumtimerjobdefinitions Displays Information about the all Timer Jobs for the Farm, Service, or Web Application. Parameters: [-scope <Farm (default) | Service | WebApplication>] [-serviceid <ID of the service if Service is specified for scope>] [-webappurl <URL of the web application if WebApplication is specified for scope>]
Here’s an example of how to return the timer jobs for the entire farm:
stsadm –o gl-enumtimerjobdefinitions
The results of running the above command are rather lengthy so I'll only show what one particular job looks like: