As pointed in http://social.technet.microsoft.com/Forums/windowsserver/en-US/5e6dc56d-9069-42e3-a7e3-87437cf8ed81/scheduled-tasks-run-in-the-default-user-profile ( No answer from microsoft yet )

I'm having the same issue. A scheduled task that we used to run perfectly in windows server 2008R2, does not execute in windows server 2012. The executable of this task, depends on user environment folders.

Even if the task has an user account specified, when ran without being logged in to the server it executes against the default profile, so the user enviroment folders are not the correct ones and the executable fails.

Somebody knows how to fix this?


I reported this bug to Microsoft last year, via our 3rd party support company. They acknowledged it as a bug, but refused to fix without a high business impact - I was hacking something in development at the time.

In my research I discovered that the correct profile will be used if you have an interactive session running as the user your scheduled task is set to run as. Microsoft suggested a workaround of running calc.exe (or some other process) prior to the scheduled task that you actually want to run. This appears to work in my case.

I've hit the bug again with a new development, so I've asked our support company to raise it with Microsoft again and referenced this post to show that other folks are hitting the issue.

  • I badgered Microsoft, via our 3rd party support company to document this, since they won't fix it and it's clearly causing people to waste time trying to work it out. KB article is at: support.microsoft.com/kb/2968540 – Tim Parkinson Jun 4 '14 at 7:52

You can either start another interactive task a minute or two before your task, which will give Windows time to load the correct profile, or launch the task via a batch file.

set "APPDATA=%USERPROFILE%\AppData\Roaming"

Copy this into a batch file, and put it in the same directory as the exe you want to run. Then change the YOUREXEHERE to the name of the EXE. Do not change anything else in the script and save.

Then run the batch as your scheduled task instead of the EXE. Whatever user runs the task, the application will use their profile.


A fix appears to be available here: https://support.microsoft.com/en-us/kb/3133689

However since I need to schedule a reboot of the server to apply this hotfix, I used the solution provided above by @brian-d, and that worked for me.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.