I read some more of the Help, which outlined the process of setting variables in the JobVariables collection with Scripts. So I wrote a shared script to add a StartTime variable to the JobVariables collection. Then I created another shared script to add an EndTime variable to the JobVariables collection, and a couple of ElapsedTime variables by using the DateDiff VBScript function to calculate the difference between %StartTime% and %EndTime%.
I scheduled the StartTime script to run as Step 1 in the job properties, and the EndTime script to run as Step 3. Then in the notification emails, I can reference the variables I set as %StartTime% and %EndTime%.
This is all fine and good...but it strikes me as a bit cumbersome and somewhat complex to document and support moving forward. It seems like at least the StartTime and EndTime variables should be built-in. Disagree? Is there an easier way to do this?
You are correct that there are no built-in variables for this information. The approach you have come up with is the best you can do for now. It is, as you say, rather cumbersome, unfortunately.
I have written this up to get fixed as part of the next major release. We already had some other variable enhancements slated, but somehow this one has never come up before.
Replies are disabled for this topic.