To create the AfterBackup.bat batch file:
- Prepare an ASCII file with commands that archive your backup snapshot, run a third-party archive tool, or perform any other post-backup tasks your site requires.
- Name the file AfterBackup.bat, and save it in the *ConfigMgrInstallPath*
\inboxes\smsbkup.box folder
**************************************************************************************************
REM @echo off
Setlocal
enabledelayedexpansion
Set
target=\\Destination_Servername\E$\Primary_SCCM_Backup\%date:~0,3%
If
not exist %target% goto datacopy
RD
%target% /s /q
:datacopy
xcopy
"\\Source_Servername\SCCM_BackupPath\*" "%target%\" /E /-Y
*************************************************************************************************** where, *Source_Server is the Primary Server from which the backup has to be copied,
and *Destination_Server is the Remote Server where you want to copy the SiteBackup.
* You can also replace the word 'copy' to 'move' if you want to move the files instead of copy.
* You can also remove the part "\%date:~0,3%" from the script if you only require present day's backup. In my case we were running out of space on one backup server to save 7 days stuff, hence i removed that date part on the script.
[Although the intended use of AfterBackup.bat is to archive SMS backup snapshots, you can use that file 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.]
Backing up SCCM Backup - Download Link - https://sites.google.com/site/ucrajee/welcome/attachments/Backing%20up%20SCCM%20Backup.pdf?attredirects=0&d=1
Process Ref: http://technet.microsoft.com/en-us/library/cc180424.aspx
Script Ref: http://smsug.ca/blogs/garth_jones/archive/2011/01/13/afterbackup-bat.aspx
Script Ref: http://smsug.ca/blogs/garth_jones/archive/2011/01/13/afterbackup-bat.aspx