In the Windows 7 task scheduler, I have a task that runs when any user logs on. This task is run as Administrator so it can get the proper priviliges and runs a bat file.
I would like to pass in the username (userid) of the user that logged in, which triggerred the task, to the bat file. I need to run the bat file using the Administrator account which results in the environment variable USERNAME being set to Administrator instead of the username that logged in.
How do you get the userid of the user that logged in causing the task to trigger?