Windows 10 Home Edition Scheduled task won't run with admin privileges

-1

I have attempted to create a scheduled task to start the w32_time task when I log on, since my windows installation - seems to want to ignore that real dst settings for my locale when I reboot - and I have to force a time update to get the clock right.

My user is an Admin user - and I can run the task manually from the an administrator command prompt.

In the scheduled task it has 'Run with highest privileges' set on - but the task fails with return code 2147943456 - which as far as I can tell means Access Denied; I am assuming this is due to a privelege issue.

This happens regardless of 'Run when user is logged on' is set or not.

If this matters; the task is scheduled to run when a user logs in.

Tony Suffolk 66

Posted 2017-06-25T07:06:14.460

Reputation: 57

Have you tried to run the task at fixed time? See if it fails if you set it to run every five minutes or so. – jitendragarg – 2017-06-25T07:17:50.153

Yes tried all of that it s fails with an Access Denied message. It is the same error code when I try to run that command in a normal (not admin) command prompt – Tony Suffolk 66 – 2017-06-25T07:22:49.420

why on earth did this get downvotes - did I ask in the wrong place ? – Tony Suffolk 66 – 2017-06-25T22:06:49.640

I have no idea why the downvotes. Also, I got an idea. What if you change the task to do something else with everything else being the same. That should help us narrow down if it is scheduler that requires access elevation or the program. – jitendragarg – 2017-06-26T04:22:07.387

@jitendragarg - I have confirmed that - Task scheduler will run a simple .bat file - and will even run it with admin privs - so I have decided to add the command into a bat file - although surely it should work without that level of indirection. – Tony Suffolk 66 – 2017-06-26T19:20:47.063

Are you trying to run the shortcut to the scheduled tasks, on a laptop, tablet or some other device with a battery? – Corporate Geek – 2018-09-21T08:25:06.483

@CorporateGeek - it is on a laptop - which is always plugged into the mains. I would be concerned if Windows dealt with permissions differently if the machine had a battery. As you can see from the accepted answer this was down to the permissions the Task Scheduler seems to use - it is very odd. – Tony Suffolk 66 – 2018-09-22T09:13:54.620

1

I was asking because I had a similar problem and I did not understand why. In my case, as documented here, I should have unchecked the setting that says "Start the task only if the computer is on AC power."

– Corporate Geek – 2018-09-24T15:20:15.850

Answers

1

An (untested) idea: Try making a shortcut icon to run the program, and have the shortcut icon run with UAC elevation; then have Task Scheduler run that shortcut.

TOOGAM

Posted 2017-06-25T07:06:14.460

Reputation: 12 651

I have tried this - using the task scheduler to run a bat file with elevated privs. I will let you know. – Tony Suffolk 66 – 2017-06-26T19:22:42.037

Having tried it over a few reboots - it does seem to work - I will mark this as answered. For the record - the Task Scheduler is set to use Higher privileges - and the bat file is a ordinary script, which detects if Admin rights are enabled - and returns an exit code if the the time sync command is executed. – Tony Suffolk 66 – 2017-06-26T22:26:34.823

1

So I've had these issues before and had to go back to my notepad to find the references, that helped explain things for me. This isn't specifically for Windows 10, but it may help answer some of the things that happen behind the scenes and it provides some tips to "debug" what's happening.

https://blogs.technet.microsoft.com/askperf/2015/02/18/help-my-scheduled-task-does-not-run/ by Blake Morrison in Windows Server Performance Team

ConceptRat

Posted 2017-06-25T07:06:14.460

Reputation: 111