0

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.

8
  • 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. Commented Jun 25, 2017 at 7:17
  • 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 Commented Jun 25, 2017 at 7:22
  • why on earth did this get downvotes - did I ask in the wrong place ? Commented Jun 25, 2017 at 22:06
  • 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. Commented Jun 26, 2017 at 4:22
  • 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." Commented Sep 24, 2018 at 15:20

3 Answers 3

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.

2
  • I have tried this - using the task scheduler to run a bat file with elevated privs. I will let you know. Commented Jun 26, 2017 at 19:22
  • 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. Commented Jun 26, 2017 at 22:26
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

0

I had the same problem trying to sync on startup. Looked everywhere. Eventually I learned enough to succeed, but not from any single source. I hope this will help those looking for answers.

  • Run Task Scheduler as admin:

    • right-click "taskschd.msc" in "C:\Windows\System32" and choose Run as Admin.
  • Create basic task: in "Task Scheduler Library -> Microsoft -> Windows -> Time Synchronization"

    • right-click to choose "Create Basic Task".
    • Follow the instructions and choose what you intend to do: Start a program "C:\Windows\System32\w32tm.exe".
    • Add arguments: "/resync" (without quotes, of course).
  • In Properties of your created basic task:

    • Choose "Change User or Group".
    • Where it says "Enter the object name to select", type in "LOCAL SERVICE".
    • It'll be changed to "nt authority/local service". Click OK.
    • It'll be shown as "LOCAL SERVICE" just like other Windows 10 tasks.
    • Check "whether user is logged on or not" and check "Run with highest privileges".
    • Check Configure for: "Windows 10".

    This is how you run scheduled task as admin!

  • Under Conditions, check "Start only if the following network connection is available: any connection".

    • Check each tab to be sure they are configured the way you want.
1
  • The Key point here is that you have to change the User to this Local Service thing - even if your User has admin rights. Good old Windows 10 - how to make things complex. Even when MS bolt on security after the fact they still mess it up :-( Commented Dec 18, 2020 at 22:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .