Programmatically Creating a Scheduled Task in Windows – 0x8004130f Error

scheduled-tasks

I am having major problems getting a scheduled task to run. The task is created fine using the ITaskScheduler interface provided by Microsoft. The task is set to run only if a user is logged on.

The problem is that the task does NOT run and the log file SchedLgU.txt cites the reason as being:

"The attempt to retrieve account information for the specified task failed; therefore, the task did not run. Either an error occurred, or no account information existed for the task.

The specific error is:

0x8004130f: No account information could be found in the Task Scheduler security database for the task indicated."

I know for a fact that a scheduled task can be created with no account information because the Google Updater scheduled task does this, and it runs fine.

All I can gather from web searches is that Windows has a "scheduled task database" that needs to have credential information for each task for it to be able to run.

Does anyone know how to modify this credential database or any other way to get my task to run?

Best Answer

The GoogleUpdateTaskMachine Task uses the "NT AUTHORITY\SYSTEM" to Run the task. You can do this by using schtasks command and the /ru switch with "System" or "" as the parameter. Like this:

schtasks /create /tn "My App" /tr c:\apps\myapp.exe /sc monthly /d 15 /ru "System"

It does not prompt for a password.

See technet for more info.

Related Topic