Some tips to help you schedule scripts to run unattended

by GRAPHISOFT and Ed Brown · updated: 11.09.2010

/!\ Some programming experience required!

Below I have scheduled some simple scripts to run with the Windows task scheduler. Here are the scripts:

test_1.bat

echo [ %date% %time% ] test_1.bat ran >> "test.log"
call test_2.bat

test_2.bat

echo [ %date% %time% ] test_2.bat ran >> "test.log

The first script prints to a file “test.log” the date and time and then calls test_2.bat which also prints the date and time to the same “test.log” file. This provides a simple simulation of the real backup. Here we can be sure that the scheduler is setup correctly and we understand the elements needed to set up the real backup correctly.

  1. Start the Task Scheduler
    • ScheduleTask.jpg

  2. Select the Task Scheduler Library
  3. Add a new folder. I suggest BIM Server.
    • CreateFolder.jpg

  4. Select your new folder
  5. Create a task
    • CreateTask.jpg

    1. General Tab: Give a name.
    2. General Tab: User must have Administrative rights
    3. General Tab: Run whether user is logged on or not
    4. General Tab: Run with highest privileges
      • GeneralTab.jpg

    5. Triggers Tab: New
    6. New Trigger: Choose how often and when to start (since this is a test I have scheduled it to run one “One Time”, and the time I set to be a few minutes after I finished the scheduling)
    7. New Trigger: Make sure it is enabled
    8. New Trigger: Okay Dialog
      • triggertab.jpg

    9. Actions Tab: New
    10. New Action: Browse for where the script is
    11. New Action: Set the “Start in” to the folder where the scripts are located (If you don’t set this only the first script will run –unless you add a path to every point where the “Call” command is used in the scripts)
    12. New Action: Okay Dialog
      • action.jpg

    13. General Tab: Okay
    14. General Tab: Add your password as required for the account that will run the task
  6. Wait for task to be run by scheduler, or force it to run by clicking on Run in the far right Actions panel. (I suggest you wait for the scheduler to do it for the first time to make sure you have everything set up right)
    • Setup_testwithRun.jpg

  7. Look at the contents of the “test.log” to make sure they indicate the time of the scripts should have run. If the file is not there, or the time is not consistent with when it ran, you need to go through the steps to find out what went wrong. (probably the “start in” folder was not set correctly)
    • logResult.jpg

  8. Now that you are comfortable with the test program. Set scheduling up for the real backup scripts. If the authority of the user is not high enough it is possible that the backups will not run. See the type of errors that could happen here: What could go wrong

  9. The real backup will take longer to run and most likely you will schedule it for some time in the middle of the night or early morning. In this case you might want to make sure that it runs correctly using “Run.”