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?