I had a similar issue with Windows 11 Task Scheduler. I was trying to configure a task at startup to run a Jenkins Agent on a new PC. I had done this successfully on Windows 11 VMs running on the build server, but this was the first time I was setting up a Dell PC on the network (Small start-up, no on-site IT support).
Symptoms:
- The Task status was Ready but it would not run.
- The Last Run Result is 0x41303 (The task has not yet run.)
- The Last Run Time is 11/30/1999 12:00:00 AM
In 'settings' I had ticked the box for 'Allow task to be run on demand' but I still couldn't run it from the Actions menu in the right-hand side bar.
Debugging
In the 'Actions' right-side menu, I clicked 'Enable All Task History' and then 'Run' for the task.
I had to hit 'refresh' and got the following in the history tab
Error: Launch Failure
Clicking on that gave some more general info:
Task Scheduler failed to start "\jenkins_agent" task for user "[redacted]". Additional Data: Error Value: 2147943726
That led me to: https://stackoverflow.com/questions/44348330/task-scheduler-failed-to-start-additional-data-error-value-2147943726
The answers there gave me the clues I needed to fix it, but in their wisdom stackoverflow admins have closed that question, so I can't update the answer there.
Solution
For some reason the account I was using, despite being admin, and having 'Log on as batch job' privilege too, just wouldn't work.
I changed the user running the task to SYSTEM:
- right-click on the task and select 'properties'
- in the 'General' tab, 'Security options' group, 'When running the task, use the following user account:' Select the 'Change User or Group...' button. Enter 'SYSTEM' in the dialog and click OK.
- Click OK and enter credentials to approve.
Then I added 'SYSTEM' to the list of user who had 'Log on as batch job'.
- Go to the Start menu.
- Type secpol.msc. and press Enter. The Local Security Policy manager opens.
- Go to Security Settings - Local Policies - User Rights Assignment node.
- Double click 'Log on as a batch job' on the right side.
- Click Add User or Group. Add 'SYSTEM'
- Click OK.
After this, I could run the task on demand and the task starts after a system reset. So it fixed the problem for me.
However, I don't know why the user account I set the PC up with would not work. I have a theory it's because I am using a general account I used for the Build server VM's and not one that is an official intranet account. Active Directory something something...