dcsimg
Results 1 to 8 of 8

Thread: Task Scheduler Status Code

  1. #1
    Ultimate Member rraehal's Avatar
    Join Date
    Jan 2002
    Location
    Denver, Colorado, USA
    Posts
    3,874

    Task Scheduler Status Code

    I have some Task Scheduler tasks set up on a windows server. The task appear to run every night. They were all giving me a status code of "0x2" under the last run result with no other information.

    All 6 of the tasks call a batch file that uses robocopy to copy some files from one office to another office as a quick offsite backup. Someday we plan to replace our current backup to the remote site with an online backup.

    It seems that even though the task were running, they were not actually copying files. I adjusted the batch files and they all ran last night except 1. It gave the status code above. I can not find that status code online. It seems that other folks are looking for its meaning too. Does anyone here know what the status "0x2" means?

    You can see the status for the tasks in the image.
    Attached Images Attached Images
    -- Mathias

  2. #2
    Stark Raving MOD Midknyte's Avatar
    Join Date
    May 2002
    Location
    Arkham Asylum
    Posts
    22,250
    Were there any error codes in event viewer?

    I can't see the scheduled times, but is it possible there is some overlap?

    Could there be another application running at the same time as that particular job? Maybe that is interfering with the schedtasks job.

  3. #3
    Ultimate Member rraehal's Avatar
    Join Date
    Jan 2002
    Location
    Denver, Colorado, USA
    Posts
    3,874
    Task Scheduler just shows this when the job completes:

    Task Scheduler successfully completed task "\Event Viewer Tasks\Replicate Drives - No Cutomer Drives" , instance "{bbbc3ace-4eb1-4e27-94a2-b76f1b3b70ea}" , action "C:\Windows\SYSTEM32\cmd.exe" with return code 2.
    There are no other tasks scheduled to start at 11PM like the task with code 2. The other tasks appear to have started and stopped while this other task was running. There could be some overlap due to the length of time a scheduled task runs.

    This server is not heavily used. It is DNS, DHCP, and AD Directory (for backup/secondary). That is why I placed these task on this server. It is not highly utilized at night.
    -- Mathias

  4. #4
    Stark Raving MOD Midknyte's Avatar
    Join Date
    May 2002
    Location
    Arkham Asylum
    Posts
    22,250
    Does it work when you run the batch/script manually?

    Exit codes are different for different apps, but I found these:
    http://www.febooti.com/products/auto...nd/exit-codes/
    The system cannot find the file specified. Indicates that the file can not be found in specified location.
    http://ss64.com/nt/robocopy-exit.html
    0×02 2 Some Extra files or directories were detected. Examine the output log for details.

  5. #5
    Ultimate Member Ol'Tunzafun's Avatar
    Join Date
    Jun 2002
    Location
    Canadian prairie
    Posts
    3,798
    Running NET HELPMSG 2 indicates:
    The system cannot find the file specified.
    Do you have both quotation marks in place? That's usually what I miss.

  6. #6
    Ultimate Member rraehal's Avatar
    Join Date
    Jan 2002
    Location
    Denver, Colorado, USA
    Posts
    3,874
    I verified the scheduled task has the correct batch file name list with the correct absolute path.

    If I run the batch file manually I can verify it works.

    I deleted the task and recreated the task. I will check the task tomorrow and see if it ran successfully. When the task returns the result code of 2, it look like everything ran but no data is actually changed.
    -- Mathias

  7. #7
    Member ua549's Avatar
    Join Date
    Jun 2006
    Posts
    67
    If it works when run manually, some sort of permissions issue is indicated. Scheduled tasks may have differing permissions than tasks run from the console (as in a test). Make sure the scheduled task specifies the user with the proper credentials.

  8. #8
    Ultimate Member rraehal's Avatar
    Join Date
    Jan 2002
    Location
    Denver, Colorado, USA
    Posts
    3,874
    I forgot to enable the task when I recreated it. The task did not run last night. The other 5 scheduled tasks all ran with a status of Completed Successfully 0x0.

    When I recreated the task I did re-enter the account the task runs under. If the account credentials were messed up, that should no longer be an issue. All six tasks use the same account. The account the task use is a regular user account except the password does not expire and the account has read/write access to the data shares. We manually change the password on special account every so often but don't want the password to expire and break some automated task.
    -- Mathias

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •