Windows Task Scheduler & Administrator user

0

I have to run automatically a batch file once a week to update a file. To do so I have created a task with Windows Task Scheduler on the company Server with the following options:

  • Security Options: user me, run only when user is logged in, Configure for Windows Server 2012
  • Trigger: every Monday at 11.00am
  • Action: start a program (the path to the bat file with quote)

This configuration works fine. However I wish the update to happen even if I am not here. So I tried to change to Security Options to:

  • User: administrator (with batch job rights)
  • Run whether user is logged on or not
  • Run with Highest privileges

Trigger and action are unchanged. I have also entered the admin password when saving the task.

On the Task History the action and task are completed, but the bat file is not run and there is no update happening on my file. The Last Run Result display:

Incorrect function (0x80070001).

Looking at other posts I have tried different combination:

  • Run with Highest privileges: ticked or not
  • The path to the bat file with or without quote
  • Try to add the path without quote in Start in (optional)

None of these worked. Any idea?

The code is working fine when activated manually. I am not sure what you mean by the command that start the batch. In the Scheduler it is on the Action tab. The action is start a program and the details is the path to the file ...run.bat When launch manually I right click on the file and select run as administrator.

Thank you in advance for your help. Sylvie

windows
batch-file
windows-server-2012
asked on Stack Overflow Sep 17, 2015 by ultima67 • edited Sep 17, 2015 by ultima67

2 Answers

0

had the same problem with a RScript.exe with batch .R file. Runs perfect with main user, also in command line, but when setting the 'run with different user account' it fails. What I did: added the ScriptUser (an anonymous user that will work forever when I have left the building) to the group Power Users. (Ok, I don't think you are allowed to set it to Administrator). But local\powerusers did it for me. The strange 'Incorrect function' without any details is solved now.

V

answered on Stack Overflow Feb 3, 2016 by langeleppel
0

I have been having similar issues with a new scheduled task I was setting up. I could run the .exe no problem by itself by clicking on it, but when task scheduler would run it, the app would execute instantly and return a success, but did not actually execute. For us, the solution was to include the Start in folder on the Action tab where you specify the application location. Leaving this value blank will default to the root directory where the most things do not have permission to run.

Task Scheduler Action Settings:

Task Scheduler Action Settings

answered on Stack Overflow Mar 19, 2020 by Chris Jarvis • edited Mar 19, 2020 by Kate Orlova

User contributions licensed under CC BY-SA 3.0