Appendix E: Using the AfterBackup.bat Batch File

Published : September 1, 2004

After successfully backing up the site, the SMS backup task runs the AfterBackup.bat batch file. The AfterBackup.bat batch file allows you to archive the backup snapshot at the end of every backup operation, and automatically perform other post-backup tasks. The AfterBackup.bat file integrates the archive and the backup operations, thus ensuring that every new backup snapshot is archived. By default, the AfterBackup.bat file does not exist and therefore has no effect on the backup operation.

Although the intended use of the AfterBackup.bat is to archive SMS backup snapshots, you can use the AfterBackup.bat file to for other tasks that you need to perform at the end of every back up operation, such as:

  • Run a SQL Server DBCC test to verify that there are no integrity problems with the SMS site database.

  • Run a site health tool, or other health tools.

Creating the AfterBackup.bat Batch File

By default, the AfterBackup.bat batch file does not exist. To use it you need to generate the file, and add commands to it, as follows:

To create the AfterBackup.bat batch file:

  1. Prepare an ASCII file with commands that archive your backup snapshot, that run a third-party archive tool, or that perform any other post-backup tasks your site requires.

  2. Name the file “AfterBackup.bat” and save it in the SMS\inboxes\ folder.

Now, every time the backup task runs successfully, it will run the AfterBackup.bat file. If the file contains archive commands, then after every site backup, store the newly generated archive in a secure location.