- Automate Backup Database on SQL Server, Part 1: Create VB Script
- Automate Backup Database on SQL Server, Part 2: Create Scheduled Task
From the previous part, I have created a VB Script that perform backup database task on SQL Server. Next, create a task schedule to execute the script on the specific time as I want. I want the script to be executed every day at 1:00 AM.
Step-by-step to create scheduled task
- Open Scheduled Task. Start -> Programs -> Accessories -> System Tools -> Scheduled Task.
- Double-click on Add Scheduled Task to create a new task schedule.
- On Scheduled Task Wizard, click Next.
- On Select Program to Run, click Browse and select the VB script file.
- Define name of the task and select when to perform the task. In this example, I want to backup daily. Click Next.
- Select time to run this task. I set to 1:00 AM every day. Click Next.
- Enter the username and password. The task will be run by this user account. If you create a VB Script that using Windows Authentication mode, you have to enter the account that has backup privilege on the SQL Server.
- Click Finish to complete creating a task schedule.
- The task schedule has been created. Now when the time is 1:00 AM, the task will be run as the user account that you’ve spcified in the task schedule.