G
Guest
Hello,
I am writing an exe that is intended to be run via a scheduled task.
However, I also need the flexibility to have users run the scheduled task
manually (right click task and select run). In the event a user runs the
task manually I need to verify their identity for logging purposes. So I
have two questions:
1. Is there a way to tell if a scheduled task was run because of its
scheduled time or if a user manually initiated it? I would prefer not to
hard code the scheduled time as a check, but rather see who has initiated the
run... i.e. NT Authority\system or MyDomain\MyUser.
2. As a follow-on to question to #1, is there a way to tell who initiated
the scheduled task to run? When the task is run manually, using
WindowsPrincipal the user always shows up as NT Authority\system (the user
that the task runs as).
Any help here would be appreciated!
Thanks,
Cory
I am writing an exe that is intended to be run via a scheduled task.
However, I also need the flexibility to have users run the scheduled task
manually (right click task and select run). In the event a user runs the
task manually I need to verify their identity for logging purposes. So I
have two questions:
1. Is there a way to tell if a scheduled task was run because of its
scheduled time or if a user manually initiated it? I would prefer not to
hard code the scheduled time as a check, but rather see who has initiated the
run... i.e. NT Authority\system or MyDomain\MyUser.
2. As a follow-on to question to #1, is there a way to tell who initiated
the scheduled task to run? When the task is run manually, using
WindowsPrincipal the user always shows up as NT Authority\system (the user
that the task runs as).
Any help here would be appreciated!
Thanks,
Cory