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"?