Windows scheduled task completed successfully but returns 0x1

I have a scheduled task on a Windows 2008 R2 server. The task includes an entry in the Start In directory. Run the task, and the batch file that it runs does what it should do. When I run the batch file from the command line, I see no errors. The problem is that the "Last Execution Result" is 0x1 (incorrect function call).

I got this at one time with the wrong DOS IF EXISTS file.txt DO (Copy file.txt file1.txt) , which was fixed by resetting the DO instruction. The current batch file does not show me any errors or warnings.

Why am I getting 0x1 result?

The batch file is running:

 PUSHD \\JUKEBOX4\Archives\CallRecording REM only move csv and wma together. wma should be created last. IF NOT EXIST C:\CallRecording (MKDIR C:\CallRecording) FOR /f %%f IN ('DIR /b *.wma') DO ( IF EXIST %%~nf.csv (MOVE /Y %%~nf.* C:\CallRecording\) ) POPD CD /D "C:\Program Files (x86)\Olim, LLC\Collybus DR Upload" CollybusUpload.exe POPD 

Information about the scheduled task:

  • Program to run: C:\Program Files (x86)\Olim, LLC\Collybus DR Upload\CallRecordingUploadFromH.cmd
  • Start: C:\Program Files (x86)\Olim, LLC\Collybus DR Upload
  • Run whether the user has been enabled or not, the highest privileges.

History screen, set recording completed

"Task Scheduler task completed successfully" \ Record portal entry from NH ", instance" {1449ad42-2210-427a-bd69-2c15e35340e6} ", action" C: \ Windows \ SYSTEM32 \ cmd.exe "with return code 1."

On the first screen of the task scheduler, the "Execution result" "Success" is displayed

+22
scheduled-tasks
source share
10 answers

Many users seem to be having problems with this. Here are some fixes:

  • Right-click on your task> "Properties"> "Actions"> "Change" | Put ONLY the file name in the "Program / Script" section, no quotes and ONLY in the directory in the "Start" section, as described, again there are no quotes.

  • Right click on your task> "Properties"> "General", | Test using any of the following:

    • "Executing with the highest privileges" (check both options)
    • "Starts the user who logs in or not" (check both options)
    • Make sure the Configure For option is set to the version of your computer operating system
    • Make sure that the user account on which the program is running has the appropriate rights.
+29
source share

I found that I have the mark “Run whether the user was turned on or not” and it returns a silent failure.

When I changed the "Run only when user logs in" checkbox, it works for me instead.

+3
source share

I had the same problem. This is just a batch file that works when launched manually, but does not work as a scheduled task.

in the batch file there were letters of letters:

 put z:\folder\file.ext 

it looks like you shouldn't use drive letters, they are tied to the user who created them - for me this small change made it work again:

 put \\server\folder\file.ext 
+2
source share

Windows Task Scheduler (Windows Server 2008r2)

Same error for me (last run result: 0x1)

Tab

  • Action: remove quotes / double quotes in

Program / script

and

start at

even if there are spaces in the path name ...

  1. General:

Run with highest privileges

and

configure for your OS ...

Now it works!

last run result: operation completed successfully

+2
source share

This answer was originally edited in the question asked.


The problem was that the WAS batch file generated a silent error. Final POPD did not do the job and was incorrectly named without opening PUSHD.

Broken code:

 CD /D "C:\Program Files (x86)\Olim, LLC\Collybus DR Upload" CALL CollybusUpload.exe POPD 

The correct code is:

 PUSHD "C:\Program Files (x86)\Olim, LLC\Collybus DR Upload" CALL CollybusUpload.exe POPD 
+1
source share

I found that the problem is that Powershell cannot run scripts, if this is for you, here is a solution.

0
source share

I ran the PowerShell script in the task scheduler, but I forgot to enable the unlimited execution policy in the elevated PowerShell console:

 Set-ExecutionPolicy Unrestricted 

After that, the error disappeared (0x1).

0
source share

On our servers, this was a problem with the system path. After updating the PHP runtime (using the installation directory, whose name includes the version number) and updating the path in the PATH system variable, we received the status 0x1 . A system error fixed the problem. Perhaps restarting the Task Manager service did this too.

0
source share

For Powershell Scripts

I have seen this problem several times when planning Powershell scripts with options on multiple Windows servers. The solution has always been to use the -File option:

  1. In the "Actions" → "Program / Script" section, enter: "Powershell"
  2. In the "Add Arguments" section, instead of simply entering "C: /script/test.ps1", use -File "C: /script/test.ps1".

Happy planning!

0
source share

It turns out that calling FTP upload using winscp, as the last thing to do in the package, caused the problem. After inserting the echo command, it works fine. Guess the source of the problem could be winscp.exe, which incorrectly reports the completion of the current OS task.

 del "C:\_ftpcrawler\Account Export.csv" /S /Q "C:\Program Files (x86)\WinSCP\WinSCP.exe" /console /script="C:\_isource\scripte\data.txt" echo Download ausgeführt am %date%%time% >> C:\_isource\scripte\data.log 
-one
source share

All Articles