Here's some code (in C#) that will enumerate all the groups, jobs, and steps, and report any variables that are overridden:
//if the adTempus server is on a different computer, replace . with the name
//for example,
//string ServerName=@"someserver";
string ServerName=@".";
void Main()
{
using (var session = Scheduler.Connect(ServerName, LoginAuthenticationType.Windows, "", ""))
{
using (var context = session.NewDataContext())
{
var root = context.GetJobGroup(null);
var seenVariables = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
CheckVariables(root, seenVariables);
}
}
}
void CheckVariables(JobGroup group,Dictionary<string,string> parentSeenVariables)
{
var seenVariables = parentSeenVariables.ToDictionary(entry => entry.Key, entry => entry.Value, StringComparer.OrdinalIgnoreCase);
CheckVariables(group.JobVariables,seenVariables,string.Format("Group \"{0}\"",group.FullyQualifiedName));
var jobs=group.GetJobs(ObjectFetchOptions.FullFetch,false);
foreach(var item in jobs)
{
CheckVariables(item,seenVariables);
}
var childGroups=group.GetGroups(ObjectFetchOptions.FullFetch,false);
foreach(var item in childGroups)
{
CheckVariables(item,seenVariables);
}
}
void CheckVariables(Job job,Dictionary<string,string> seenVariables)
{
CheckVariables(job.JobVariables,seenVariables,string.Format("Job \"{0}\"",job.FullyQualifiedName));
foreach(var item in job.Steps)
{
CheckVariables(item.JobVariables, seenVariables, string.Format("Job \"{0}\" step {1}", job.FullyQualifiedName,item.StepNumber));
}
}
void CheckVariables(ArcanaDevelopment.adTempus.Client.Collections.JobVariableCollection variables, Dictionary<string, string> seenVariables, string locationDescription)
{
foreach (var item in variables)
{
string seenLocation;
if (seenVariables.TryGetValue(item.Name, out seenLocation))
{
WriteOutput(string.Format("{0} overrides variable \"{1}\" from {2}", locationDescription, item.Name, seenLocation));
}
else
{
seenVariables.Add(item.Name, locationDescription);
}
}
}
void WriteOutput(string output)
{
Debug.WriteLine(output);
}
You can run this code using LINQPad or Visual Studio.