Good morning AskPerf! Kapil Patry here from the Microsoft Platforms Support Team. I am blogging today about an issue I recently worked. This particular issue dealt with the creation of a task using Task Scheduler on a Windows 2008 R2 Server (can occur on Windows 7 as well). When I attempted to create a scheduled task, the following error appeared:
An error has occurred for the task <task name>. Error message: The following error was reported: A specified logon session does not exist. It may have already been terminated..
This error came up whether I was logged on as a Local Administrator, Domain Administrator, or any other user that had rights to log on locally.
After extensive research, I found that the above error will only occur if the following Security Policy is enabled and you select the “Run whether user is logged on or not” Security option on the General tab, when creating a new task:
SECPOL.MSC | Security Settings | Local Policies | Security Options
Network access: Do not allow storage of passwords and credentials for network authentication
To resolve this issue, simply Set this policy to Disabled:
The new version of Task Scheduler (Windows Vista onwards) uses Windows Credential Manager to store the credentials of the account that is specified to perform a task. If the Network access: Do not allow storage of passwords and credentials for network authentication policy is enabled and applied, Credential Manager cannot store the credentials locally, thus this error message appears.
NOTE you will not receive this error if the “Run only when user is logged on” Security option on the General tab is selected (we do not store passwords in this scenario).