Scheduled task concatenation

I’ve been trying to get a list of Scheduled tasks and concatenate the ID’s that run them. I’ve found relevance for both but not sure how to concatenate them.

User IDs of (principals of (definitions of (scheduled tasks)))

names of scheduled task

Output I’m looking for

Scheduled Task Name - UserID

Assuming every scheduled task has exactly one definition and principal, you should be able to loop through the scheduled Tasks and retrieve multiple properties from the task as

(name of it & " - " & user id of principal of definition of it) of scheduled tasks

If you get any “singular expression” messages we can add error trapping

1 Like

That did it. Thanks!

I modified the task to get additional info. The list is much shorter when I add next run time of it which is good because I don’t see all the system generated tasks.

Why does it generate the Error: Singular expression refers to nonexistent object.?

(name of it, enabled of it, last run time of it, next run time of it, user id of principal of definition of it ))of scheduled tasks

You are asking for a singular value like ‘next run time of it’ that doesn’t exist.

One way to avoid that is to use plurals like ‘next run times of it’. If the next time doesn’t exist, that whole task is removed from the result.

1 Like

Some systems return results and others return . Am I missing something in the logic?

Think I figured it out. Just needed a good nights sleep.