Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a onstartup task that I want to automatically run, regardless of if someone is logged in or not.

I've set it up as Run whether user is logged in or not, Do not store password1, and Run with highest privileges, which I assume would work, using the below code:

schtasks /create /tn "My OnStartup Task"  /TR "powershell blah.ps1" /sc ONSTART /f /NP /RL HIGHEST

After enabling task scheduler history, I'm getting errors like:

Event ID: 104: Task Scheduler failed to log on "<Task Author>" . Failure occurred in "LsaLogonUser" . User Action: Ensure the credentials for the task are correctly specified. Additional Data: Error Value: 2147943711.

Event ID: 311: Task Scheduler failed to start Task Engine ""  process due to an error occurring in "LUAIsElevatedToken" . Command="taskeng.exe" . Additional Data: Error Value: 2147943711.

Event ID: 101: Task Scheduler failed to start "\My OnStartup Task" task for user "<Machine>\<Task Author>". Additional Data: Error Value: 2147943711.

I've specifically set not to store the password, yet the errors are saying it's trying to use the password. I recall reading somewhere that not the storing the password checkbox also counts for "do not run interactively", or something. Could someone point me into the right direction here?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

You should not be specifying a user account under which to run the task if you do not want to save the password. Run it as system if that would work or save the user account and password with the task.

share|improve this answer
    
Thanks for that Greg, I went through the permutations of flags and user (none, local, system), and found the system user actually lets it run. Thanks :) –  glasnt Apr 23 '12 at 0:46

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.