Task scheduler- task completed “successfully” with exit code 0x8007001

scheduled-taskswindows 10

I am running a daily task on Windows 10 Pro which is supposed to

  • wake the computer from hibernation
  • start cmd.exe, run a command script to copy a file to a network drive, create a log file
  • shutdown the computer

When starting the task manually from within the task scheduler, everything is executed as intended.

When leaving the computer in hibernation mode, the task scheduler wakes the computer at the specified time, but apparently the command file (.cmd) ist not executed at all. No log file ist created, no file is copied, and the computer is not shut down. The task is marked as "successfully completed with the return code 2147942401" which is hex 0x80070001.
This error code seems to indicate an "illegal function", but I have no clue what that might be, especially since the task runs fine when started manually, as said.

Here's an overview of the task settings (translated from German, but it should be clear):

  • General:
    execute regardless of user login; don't store password; highest privileges; configured for Windows 10

  • Actions: start program cmd.exe; arguments: /c "path-to-cmd-script\script.cmd >> logfile.txt"; start in: empty

  • Conditions: reactivate computer

  • Settings: allow execution if needed; if execution fails restart every 10 minutes; end task if execution longer than 3 days; force ending of active task if not stopped on request; don't start new instance

I have another task doing a backup with exactly the same setting which is running fine (wakes up, runs a script, then shuts down computer).

Any hint highly appreciated, questions welcome.

Best Answer

Actually, no. However, I have used the simplest task scheduler settings and now it works.

General:

  • use only when user is logged in
  • use highest privileges
  • configure for Windows 10

Action:

Program/script: C:\Windows\System32\cmd.exe
Arguments: /c <your batch file with parameters>

Conditions:

  • re-activate computer

Settings:

  • allow execution if needed
  • execute as soon as possible if start was missed
  • if task fails, restart every 5 minutes
  • terminate task if execution exceeds 3 days
  • force termination if not stopped on request
  • stop current instance if task already running

Now it's running every day at the specified time for months.

Related Question