I'm using Windows Server 2008 task scheduler to run a task when a user logs on, but I would like some way of the task being able to access the name of the user who is logging on. I don't know if there is an environment variable I can access in the task or I can add something in as a parameter when the task runs?
Asked
Active
Viewed 1,587 times
1 Answers
0
Edit:
You might want to attach the trigger of your task to a certain event so you can reference the event's data. I can't exactly tell you what event you would want to attach the trigger to (e.g. is it only remote logins you're interested in, etc.), but I think this might very well be what you're looking for.
Hope it helps!
Original answer:
You might want to have a look at this handy list, which should give you an idea. In the most simple of cases %USERNAME%
might just be what you need (e.g. in a batch file you might run).

Michael
- 161
- 3
-
1%USERNAME% returns the username which the task is running under, which is always the same user - I want to know the username that has logged on – wizzardmr42 Apr 12 '13 at 08:36
-
Gotcha. Changed my answer to what I hope is somewhat more appropriate :). – Michael Apr 12 '13 at 09:28