Windows Task Scheduler Help

Osama Mansoor 86 Reputation points
2021-10-20T05:26:04.757+00:00

Hi Experts,

I have a backup script which I wanted to run DAILY every 3 hours but it's not working whats I am doing there.

The script did not run in between 11:00 PM to 11:00 AM.

141948-1.jpg

141880-3.jpg

141966-4.jpg

Windows for business Windows Client for IT Pros User experience Other
0 comments No comments
{count} votes

12 answers

Sort by: Most helpful
  1. Leon Laude 86,026 Reputation points
    2021-10-20T06:00:02.593+00:00

    Hi @Osama Mansoor ,

    Did you by any chance run the scheduled task manually first? Try changing the task to the current day, then let it run automatically and see if it runs.
    You might also want to ensure that the Run whether user is logged on or not option is checked, the default setting is Run only when user is logged on which means the task will not run until someone logged on to the server.

    ----------

    If the reply was helpful please don't forget to upvote and/or accept as answer, thank you!

    Best regards,
    Leon


  2. MotoX80 36,291 Reputation points
    2021-10-21T13:04:31.87+00:00

    Already on Run only when user is logged on

    You might also want to ensure that the Run whether user is logged on or not option is checked, the default setting is Run only when user is logged on which means the task will not run until someone logged on to the server.

    As Leon pointed out, you DO NOT want that option selected. Because if the pc would reboot due to installing Windows updates, you won't be logged on and the task will not run. You have 2 options, one is to run it as your account. That requires you to enter your password when saving the task. You would want to use that option if your backup task is copying files to a network share that requires authentication. If you only use local resources then you can use SYSTEM as the account. That will not require a password.

    For the trigger, I would suggest trying these settings.

    142470-capture.jpg

    Set it run at 1 AM daily, repeat every 3 hours for a duration of 1 day and to stop at the end of the repetition.

    I highly recommend that whatever program you are running generate a log file that you can query to see task start and stop times, and any error messages so that you can troubleshoot what the task is doing. If the program you are running does not natively provide that, then build a .bat file to call the program and have the task execute cmd.exe and pass the bat file name as an argument. Let me know if you need more help setting that up.

    0 comments No comments

  3. Osama Mansoor 86 Reputation points
    2021-10-22T04:56:39.903+00:00

    Is this ok ?
    142797-10.jpg

    142798-11.jpg


  4. Osama Mansoor 86 Reputation points
    2021-10-25T05:55:48.777+00:00

    After the above task scheduler, only 3 files were created in a single day.

    File 01 created at 12:46 PM
    File 02 Created at 4:46 PM
    File 03 created at 8:46 PM

    i am unable to understand why it does not create a file in AM scheduled like it should create at 12:46 AM but file not created.

    143311-1.jpg

    143321-2.jpg


  5. Osama Mansoor 86 Reputation points
    2021-10-25T12:29:40.927+00:00

    i compared both events for AM and PM both events are the same as tasks run for both but the script is generated only for PM which is wired.

    expdp wbg/chl@chl full=Y directory=dbbackup dumpfile=CHL_%date:~4,2%_%date:~7,2%_%date:~10,4%
    %time:~0,2%%time:~3,2%.dmp logfile=CHL_%date:~4,2%_%date:~7,2%_%date:~10,4%%time:~0,2%%time:~3,2%.log
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.