Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to create a script that uses schtasks to schedule a task, without entering a password. The task is intended to simply run under the currently logged on user, who actually creates the task (via the script).

Thus, the user's credentials are there, otherwise the task wouldn't have been created.

Here is an example of such statement I used in my tests:

schtasks /create /tn startCalc /tr "C:\WINDOWS\system32\calc.exe" /sc DAILY /st 22:53:00

Unfortunately however, "Task Scheduler" fails to run the scheduled task with the following logged error:

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.

Now, the task is not a system-level command or anything like that. It is a benign user-level application (e.g. Notepad or Calc).

I could, of course, embed in the script some code that would ask the user to type his password, but I prefer to avoid doing so.

To further clarify the problem, my script should be able to run on "irresponsible home user" computers, who have a single account with admin privileges but without a password! (sounds crazy but there are many users out there working this way whom I can't really educate). So, even if included a password entry prompt in the script, this wouldn't work for those users who have an "empty password".

Is there a way to tell schtasks to NOT require a password, similar to what to what the "Scheduled Task Wizard" does via the "run only if logged on" checkbox in "advanced properties"?

share|improve this question
    
Can't recreate the problem - for me, the task gets created and I can run it via the schtasks or through the GUI under the context of the user... Can you rephrase the actual problem? (sorry) –  William Hilsum Sep 23 '10 at 13:19
    
That's the actual problem. Are you running the same EXACT command as quoted above? Are you running it under an account with Admin privileges? Do you have an EMPTY password for that account? If you answer 'Yes' to all these questions, then something else is different in your system. –  Android Eve Sep 23 '10 at 22:48

2 Answers 2

try adding "/ru system" to the end of the command

share|improve this answer
    
Thanks for the attempt (you get +1 for this). However, /ru runs the task under LocalSystem which uses the "default user" context, which is NOT what I want. I need the scheduled task to run under the account in which the user ran the script containing "schtasks". –  Android Eve Sep 23 '10 at 22:45
up vote 0 down vote accepted

I ended up embedding in the script a requirement for the user to type his password. AFAIK, either schtasks or its documentation is buggy.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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