469,646 Members | 1,558 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,646 developers. It's quick & easy.

Log who ran a scheduled task


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!

Feb 24 '06 #1
1 1665
Hi Cory,

Why do you need to have the user run the application from scheduled task
manually? Instead, you may have them run from a shortcut on desktop, or
command line, in this way the application can tell who has initiated it,
i.e. NT Authority\system or MyDomain\MyUser. So, I think a better
deployment strategy may help on the issue.

Luke Zhang
(This posting is provided "AS IS", with no warranties, and confers no

Feb 27 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by A. Lovhaug | last post: by
6 posts views Thread by John Bowman | last post: by
reply views Thread by Myster Edd | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.