Misc

How To Fix Task Scheduler (0x1) Error in Windows

The task scheduler error 0x1 is the most common error I see with microsoft windows scheduled tasks. 

I have seen it on many microsoft windows computers and servers at my work.  I have fixed this error many times and the fix is always the same or very similar.

What Causes The Task Scheduler (0x1) Error?

The error code (0x1) in a scheduled task means, Incorrect function called or unknown function called. This is usually caused by a microsoft windows path issue in the scheduled task.

Sometimes the task will run and complete successfully but the task will not have actually done what you needed to do, I will go through the fixes below.

How To Fix Task Scheduler (0x1) Error in Windows

To fix the error 0x1 you need to enter a path in the “Start in (optional)” field in the edit action part of the scheduled task. This will help microsoft windows to run the task in the correct system path.

To do this follow these steps

  1. Open task scheduler by clicking start and typing in “Task Scheduler” and click on the app
  2. Click task scheduler library
  3. Right click on the required task and select properties
  4. Click the actions tab
  5. Click edit
  6. In the Start in (Optional) field type in the required path
  7. If you are not sure what the correct path should be copy the path minus the process from the Program/Script field
  8. In the example below I put c:Program FilesMicrosoft Security Client
    scheduled task edit action
  9. Click OK to close the edit action screen
  10. Click OK to close the scheduled task
  11. Re-run the scheduled task again
  12. If you see the last run result is 0x0 then this means the task ran successfully

scheduled task 0x0

The below video also shows you the above process

YouTube video

How To Fix Task Scheduler (0x1) Error When Running Batch Files

To fix the error 0x1 when running batch files in a task scheduler you need to enter a path in the “Start in (optional)” field in the edit action part of the scheduled task.

You get the error 0x1 when a task scheduler is running a batch file because it can not find a file.  In the example below I am running the following scheduled task

  • Task Name : Test Batch File
  • Program/script : C:DataRobocopy.cmd
  • Start in (Optional) : blank

Robocopy.cmd contents (FYI Robocopy.exe is located in C:Data folder)

Robocopy.exe “C:DataFiles” “D:Backup%DATE%”

When a scheduled task runs if the “Start in (Optional)” field has not been filled out it will use the microsoft windows default path of C:WindowsSystem32.  The issue with this is that it will not find the robocopy.exe file to start the file copy.

So there are a few fixes here

  1. Open task scheduler by clicking start and typing in “Task Scheduler” and click on the app
  2. Click task scheduler library
  3. Right click on the required task and select properties
  4. Click the actions tab
  5. Click edit
  6. In the Start in (Optional) field type in the required path (In the above example it will be C:Data

You could also copy the robocopy.exe file to C:WindowsSystem32 folder or update the Robocopy.cmd with the full path to the .exe as per below

C:DataRobocopy.exe “C:DataFiles” “D:Backup%DATE%”

How To Fix Task Scheduler (0x1) Error When Running Powershell Scripts

To fix the error 0x1 when running powershell scripts in task scheduler you need to set the execution policy to bypass in the task scheduler arguments.

To do this follow these steps

  1. Open task scheduler by clicking start and typing in “Task Scheduler” and click on the app
  2. Click task scheduler library
  3. Right click on the required task and select properties
  4. Click the actions tab
  5. Click edit
  6. In the “Program/script” field type in powershell.exe
  7. In the “Add arguments” field enter -ExecutionPolicy Bypass -File “C:DataScript.ps1”
  8. In the Start in (Optional) field type in the path of where the powershell script is located  C:Data

powershell scheduled task

Frequently Asked Questions

What does 0x1 mean in Task Scheduler?

The error 0x1 will appear in the last run result in a task scheduler if it had an issue running the task. It will have an issue where is can not find a required file, This is usually resolved by setting the start in path within the scheduled task.

What does return code 2147942401 mean?

The return code 2147942401 means that there is an error in the action argument in the scheduled task. The action argument field should be in the format -ExecutionPolicy Bypass -File “C:DataScript.ps1”

Is 0x1 the same as 0x01?

Yes they are the same error code. 0x1 will always show in microsoft windows task scheduler, 0x01 will show in other applications depending on what the programmer put in the code to show the error

Home » Misc » How To Fix Task Scheduler (0x1) Error in Windows