Schedule Server 2003 Backup Batch File

-->

  • Dec 27, 2019 5. If you like to use this freeware to handle the scheduled backup, you can just click OK and go to the next step. If you want to Task Scheduler to run the backup, click on the Advanced tab, and check the option Use Task Scheduler to run this backup. Click “Start Backup” to start this file backup. Go to Task Scheduler to find this.
  • I have a batch file in Windows 7 Professional that runs RASDIAL and creates a VPN to Windows Server 2003. The batch file then maps a drive and then I do a backup routine. This batch file runs flawlessly by double clicking it. Using Task Scheduler, the batch file executes properly except for.

This step-by-step article describes how to use the Backup feature to back up and restore data on your Windows Server 2003-based computer.

Original product version: Windows Server 2003
Original KB number: 326216

This is the silly part. THEN, go the folder with the batch file (mine is simply called batch) and ADD the administrator permissions to full for the folder and each of the batch files. If the batch files have to write some data, then the target for the task ALSO should have explicit full permissions. Now try to run the task from the Task Scheduler. If that line is not present, the file will only list all files to be deleted in the cleaup.txt file, located in the destination directory (G: Backup cleanup.txt in the above example). If you add the cleanup portion to the end of your backup batch file, you may want to remove the '@pause' line at the end of the backup portion, so everything can.

Summary

This article is intended for users who back up and restore data, and it includes information about how to back up and restore the system configuration and local registry.

To perform the procedures in this article, you must be logged on as a member of the Administrators group or the Backup Operators group.

Backing up the server

Backup Batch File Example

You can manually back up data or use the Backup Wizard, which is included in the Backup feature. You can back up the whole contents of the server, selected portions of the server, or the system state data (the system configuration information).

To back up selected files or folders

  1. Click Start, point to All Programs, point to Accessories, point to System Tools, and then click Backup. The Backup or Restore Wizard starts.

  2. Click Advanced Mode.

  3. Click the Backup tab.

  4. On the Job menu, click New.

  5. Expand the drive or folder that contains the items that you want to back up. Click to select the check boxes next to the files, folders, or drives that you want to back up.

  6. In the Backup destination box, specify the destination for the new job. To do so, do one of the following:

    • If you want to back up files and folders to a file, click File.
    • If you want to back up to tape, click a tape device.

    Note

    If a tape device is not connected to your computer, File is the only backup media type that is available in the Backup destination box.

  7. In the Backup media or file name box, do one of the following:

    • If you're backing up to a file, specify a path and file name for the backup (.bkf) file. Or, click Browse, specify a file name and location where you want to save the file, and then click Save.
    • If you're backing up to tape, click the tape that you want to use.
  8. On the Tools menu, click Options. Specify any additional backup options that you want on the appropriate tabs of the Options page. Click OK.

  9. Click Start Backup.

  10. If you want to set advanced backup options, such as data verification or hardware compressions, click Advanced. Specify the options that you want, and then click OK.

  11. Review the settings on the Backup Job Information page. Specify whether you want this backup to replace the information that is already present on the destination media, or add this backup to the existing information.

  12. Click Start Backup.

To back up the system state (including registry settings)

To back up the system state (including the registry hives system, software, security, the Security Accounts Manager (SAM), and the default user (but not HKEY_CURRENT_USER)), follow these steps:

  1. Click Start, point to All Programs, point to Accessories, point to System Tools, and then click Backup. The Backup or Restore Wizard starts.

  2. Click Advanced Mode.

  3. Click the Backup tab.

  4. On the Job menu, click New.

  5. Click to select the System State check box.

  6. Click to select the check boxes next to any other files, folders, or drives that you want to back up.

  7. In the Backup destination box, specify the destination for the new job. To do so, do one of the following:

    • If you want to back up files and folders to a file, click File.
    • If you want to back up to tape, click a tape device.

    Note

    If a tape device is not connected to your computer, File is the only backup media type that is available in the Backup destination box.

  8. In the Backup media or file name box, do one of the following:

    • If you are backing up to a file, specify a path and file name for the backup (.bkf) file. Or, click Browse, specify a file name and location where you want to save the file, and then click Save.
    • If you are backing up to tape, click the tape that you want to use.
  9. On the Tools menu, click Options. Specify any additional backup options that you want on the appropriate tabs of the Options page. Click OK.

  10. Click Start Backup.

  11. If you want to set advanced backup options, such as data verification or hardware compressions, click Advanced. Specify the options that you want, and then click OK.

  12. Review the settings on the Backup Job Information page. Specify whether you want this backup to replace the information that is already present on the destination media, or add this backup to the existing information.

  13. Click Start Backup.

Sql server batch

To schedule a backup for a later time or date

You may want to run a backup operation when there's low system usage. However, such times may be late at night or on weekends. You can schedule backup jobs to run on a particular day and time.

Note

To schedule a backup operation, the Task Scheduler service must be running.

  1. Click Start, point to All Programs, point to Accessories, point to System Tools, and then click Backup. The Backup or Restore Wizard starts.

  2. Click Advanced Mode.

  3. Click the Backup tab.

  4. On the Job menu, click New.

  5. Expand the drive or folder that contains the items that you want to back up. Click to select the check boxes next to the files, folders, or drives that you want to back up.

  6. In the Backup destination box, specify the destination for the new job. To do so, do one of the following:

    • If you want to back up files and folders to a file, click File.
    • If you want to back up to tape, click a tape device.

    Note

    If a tape device is not connected to your computer, File is the only backup media type that is available in the Backup destination box. 1985 omc 800 stringer sterndrive repair manual.

  7. In the Backup media or file name box, do one of the following:

    • If you're backing up to a file, specify a path and file name for the backup (.bkf) file. Or, click Browse, specify a file name and location where you want to save the file, and then click Save.
    • If you're backing up to tape, click the tape that you want to use.
  8. On the Tools menu, click Options. Specify any additional backup options that you want on the appropriate tabs of the Options page. Click OK.

  9. Click Start Backup.

  10. Click Schedule.

    If a message prompts you to save your current backup selections, click OK. On the Save As page that appears, specify a name and location where you want to save the backup, and then click Save.

  11. In the Job name box, type a name for the scheduled backup job, and then click Properties.

  12. Click the Schedule tab. In the Schedule Task box, click how frequently you want the backup job to run, and then in the Start time box, specify a time when you want the backup to run, and then click OK.

  13. On the Set Account Information page that appears, type a user name and password of the user whom you want to run the scheduled backup for, and then click OK.

  14. Click OK.

    The backup job that you scheduled appears on the calendar on the Schedule Jobs tab. The scheduled backup job automatically starts at the time and data that you specified.

  15. Close the Backup Utility page.

To back up data by using the Backup Wizard

  1. Click Start, point to All Programs, point to Accessories, point to System Tools, and then click Backup. The Backup or Restore Wizard starts.

  2. Click Advanced Mode.

  3. On the Welcome tab, click Backup Wizard (Advanced). The Backup Wizard starts. Click Next.

  4. Specify what you want to back up, and then click Next.

  5. If you selected Back up selected files, drives, or network data in step 4, expand the drive or folder that contains the items that you want to back up, click to select the check boxes next to the drive, folder, or file that you want to back up, and then click Next.

  6. Specify the backup type, destination, and name in the appropriate boxes, and then click Next.

    Note

    If a tape drive isn't connected to your computer, File is the only backup media type that is available in the Select the backup type box.

  7. Review the settings that appear on the Completing the Backup Wizard page. If you want to specify advanced backup options, click Advanced, specify the options that you want, and then click OK.

  8. Click Finish.

Schedule Batch File

Restoring data to the server

If a data loss occurs, you can restore your backup data manually or by using the Restore Wizard, which is included in the Backup feature.

To restore selected files from a file or tape

  1. Click Start, point to All Programs, point to Accessories, point to System Tools, and then click Backup. The Backup or Restore Wizard starts.

  2. Click Advanced Mode.

  3. Click the Restore and Manage Media tab.

  4. Click the media that you want to restore, and then click to select the check boxes next to the drives, folders, or files that you want to restore.

  5. In the Restore file to box, specify the location where you want to restore the files by doing one of the following:

    • If you want to restore the files or folders to the same location in which they were when you backed up the data, click Original location, and then go to step 7.

    • If you want to restore the files or folders to a new location, click Alternate location.

      This option preserves the folder structure of the backed-up data.

    • If you want to restore the files and folders to a single location, click Single folder.

  6. If you selected Alternate location or Single folder, type the location in which you want the data to be restored, or click Browse and select the location, and then click OK.

  7. On the Tools menu, click Options. Click the Restore tab, specify the restore option that you want, and then click OK.

  8. Click Start Restore.

  9. On the Confirm Restore page that appears, click Advanced if you want to set advanced restore options, and then click OK.

  10. Click OK to start the restore operation.

To restore the system state data (including registry information)

Rust server batch file
  1. Click Start, point to All Programs, point to Accessories, point to System Tools, and then click Backup. The Backup or Restore Wizard starts.

  2. Click Advanced Mode.

  3. Click the Restore and Manage Media tab.

  4. In the Items to restore box, expand the media that you want to restore, and then click to select the System State check box.

  5. Click to select the check boxes next to any other drives, folders, or files that you want to restore.

  6. In the Restore file to box, specify the location where you want to restore the files by doing one of the following:

    • If you want to restore the files or folders to the same location in which they were when you backed up the data, click Original location, and then go to step 8.
    • If you want to restore the files or folders to a new location, click Alternate location.This option preserves the folder structure of the backed-up data.
    • If you want to restore the files and folders to a single location, click Single folder.

    Note

    If you do not designate an alternate location for the restored data, the restore operation erases the current system state data and replaces it with the information that you are restoring.

  7. If you selected Alternate location or Single folder, type the location in which you want the data to be restored, or click Browse and select the location.

  8. Click Start Restore.

  9. On the Confirm Restore page that appears, click Advanced if you want to set advanced restore options, and then click OK.

  10. Click OK to start the restore operation.

To restore backed up data by using the Restore Wizard

  1. Click Start, point to All Programs, point to Accessories, point to System Tools, and then click Backup. The Backup or Restore Wizard starts.
  2. Click Advanced Mode.
  3. On the Welcome tab, click Restore Wizard (Advanced). The Restore Wizard starts. Click Next.
  4. In the Items to restore box, expand the media that you want to restore, click to select the check boxes next to the drives, folders, or files that you want to restore, and then click Next.
  5. Review the settings that appear on the Completing the Restore Wizard page. If you want to specify advanced backup options, click Advanced, specify the options that you want, and then click OK.
  6. Click Finish.

Troubleshooting

You can't back up or restore data

You must be a member of the Administrators group or the Backup Operators group on the local computer to back up or restore data.

You can't schedule a backup operation

The Task Scheduler service must be running before you can schedule a backup. If the Task Scheduler service isn't already running, follow these steps to start it:

  1. Click Start, and then click Run.
  2. In the Open box, type cmd, and then click OK.
  3. At the command prompt, type net start schedule, and then press ENTER.

The Windows Task Scheduler is a useful tool for automating various tasks within the Windows operating system. It provides a simple graphical interface and is much easier to navigate than command prompt or Powershell. Though it does have some limitations when compared to the aforementioned options, there are still numerous actions that can be automated using the Task Scheduler.

One of the most useful tasks that can be automated, at least from my perspective as a Database Administrator, is the ability to perform automated file deletion. In the example outlined below, I will be creating a scheduled task to run daily which will delete files from a specified directory that are older than 90 days.

To provide a little background on this, the example I will be working with pertains to an automated SQL runtrace Agent Job that I have running on the server. The job runs daily and runs a continual trace logging any transactions that take longer than 3 seconds. As a result, a new file is added to the directory every day. Though each file is only around 11MB, over time this can begin to add up and deleting these files eventually becomes a necessity.

The steps outlined below will walk you through the steps of creating a new scheduled task which will call the ForFiles command to handle automatically deleting the older files.

The first step is to log into the server containing the directory from which you want to automate file deletion.

Once logged in, launch the TaskScheduler.

Once the Task Scheduler window appears, right-click Task Scheduler Library and select New Folder. Though this step is not technically necessary, I find putting related tasks into their own folder provides better organization when searching for a particular task.

In this example I will call the folder DBA.

Once the folder has been created you will see it listed under the default Microsoft folder. The next step is to right-click the newly created folder and select Create Task.

The Create Task window will open. On the General tab you’ll want to provide a Name for the task. Here you can also change the User assigned to run the task. Save yourself from it band syndrome ebook torrents. In this example I am using my account but best practice would suggest using a proper service account which has sufficient permissions on the server.

You will also want to select the radio button next to Run whether user is logged on or not. This will make sure that the task will be called regardless of the the user’s connectivity to the server.

Next, click on the Triggers tab. This is where we will configure when the scheduler will run. Once on the Triggers tab click the New… button at the bottom of the window.

The New Trigger window will be displayed.

As seen in the screenshot below, I have configured this trigger to begin on a schedule and to run on a Daily basis at 7:00PM.

Once you have configured your trigger click OK.

You should now see your newly created trigger listed.

Next, click on the Actions tab and click New… at the bottom of the window.

The New Action window will be displayed. This is where you will call the ForFiles script and configure the command line argument to delete the files. This is the most important step.

Schedule Server 2003 Backup Batch File

Schedule Server 2003 Backup Batch File Examples

Make sure the Action being called is set to Start a program. This should be the default setting but if not, just select it from the drop-down.

Next enter ForFiles into the Program/script text box.

The final step requires you to specify the argument that you want to pass to the ForFiles script.

In this example I am passing the following argument:

/p 'C:DBASQLTrace' /s /d -90 /c 'cmd /c del @file'

Depending on your specific needs, you will need to change the directory being specified as well as the number of days back. The above argument will remove files older than 90 days from the C:DBASQLTrace folder.

Once you have configured the argument click OK.

You will now see the newly created action listed.

There are two additional tabs, Conditions and Settings. Though it is not necessary to change any of the default configuration options on these two tabs, they are worth reviewing. Depending on the scheduled task you are creating, some changes may be beneficial.

Though I rarely do anything with the Conditions tab, the Settings tab does have a couple options that I find to be useful. Though I am not selecting them for the purposes of this example, the highlighted options below can be useful depending on the task being scheduled. You can also instruct the Task Scheduler to self-delete if it has not been called for a particular number of days.

Once you have fully configured the task and any additional options click OK.

You will be prompted to enter the necessary credentials based on the account you selected to run the task when configuring the General tab. Once the credentials are entered you will see the newly created scheduled task listed under the task library folder you created.

If you wish to manually execute the task to test and make sure it performs as intended you can do this by right-clicking the task and select Run.