I am having a strange problem with the Windows Server 2008 Task Scheduler. I have to run a small command-line application every few minutes. This application just executes a quick web service call on the localhost and adds an entry to a log file; so it should not need anything special in terms of permissions.
First, I created a new user account "my_scheduler" just for the task.
- This account is a member of the Users group (not sure what other settings I should turn on/off) and set it's password to not expire.
- I then create a task to run the application every few minutes.
- I set it to "Run whether user is logged on or not"
- Turned on "Do not store password. The task will only have access to local resources" (I did this since it's not hitting anything on the network).
- I did not turn on "Run with highest privileges" since it does not seem to need them.
- I set the schedule to "After triggered, repeat every 30 minutes for a duration of 1 day"
- "Allow task to be run on demand" (no other settings enabled).
However, I notice that in the Event Log, I see a bunch of these warnings whenever the task is run:
Windows cannot find the local profile and is logging you on with a temporary profile. Changes you make to this profile will be lost when you log off.
Even though I get the warning, the task is executing (I see the log entries appearing).
Another (possibly related) issue is that I also see that it's starting multiple copies of the task (within a few seconds of each other) even though it should only start one. This is also a big problem.
Any idea how I can fix this?
The error you see in the event logs is most likely a result of the user you created not having a profile set up. Bascially it's complaining that there's no user folder for your service account under %SYSTEM DRIVE%\Users\
As you created the account specifically for this task, you can safely ignore the error, as it probably doesn't need a user profile anyway. You could also log on to the server as that account to create the user profile, or change the account executing your scheduled task to one of the built in service accounts, like LocalService or NetworkService (assuming, of course that this won't break permisions on your task).
I don't think you've provided enough information to discern why your task is running multiple instances, but it's probaly not related to that error you're seeing.