To ensure that a recent backup snapshot is always available, it is recommended that you archive the backup snapshot every time the SMS backup task completes a backup cycle. The standard backup task overwrites the previous created backup by default .
To accomplish that, you can use the AfterBackup.bat file to run a third-party tool (7Zip) that automatically archives the backup snapshot every time you back up your site. After successfully backing up the site, the SMS backup task runs the AfterBackup.bat batch file. The AfterBackup.bat file integrates the archive and the backup operations, thus ensuring that every new backup snapshot is archived.
All this script does is move the backup folder to a folder named the day of the week. If the destination already exists, then it is deleted first. Resulting in 7 days of backup or more
To use the AfterBackup.bat file
- Prepare an ASCII file with commands that archive your backup snapshot, or that perform any other post-backup tasks your site requires.
- Name the file "AfterBackup.bat" and save it in the SMS\inboxes\smsbkup.box folder. Now, every time the backup task runs successfully, it will run the AfterBackup.bat file.
- Every time after the AfterBackup.bat file archives the site’s backup snapshot, store that archive in a secure location.
Here is an Afterbackup.bat file that will make a daily backup of ConfigMgr Backup, so that you have a full week of backups.
<span class="kwrd">Set</span> BackupDir=\\xxx\sccm12_backup$\CM12_backup <span class="kwrd">Set</span> ArchiveDir=\\xxx\sccm12_backup$\CM12_backup_archives <span class="str">"%ArchiveDir%\7za.exe"</span> a -r <span class="str">"%ArchiveDir%\%date:~0,2%%date:~3,2%%date:~-4%.7z"</span> <span class="str">"%BackupDir%"</span>
- Place the file in the following location :
Image may be NSFW.
Clik here to view.
- Make sure you copy the 7zip (command line executable) in the root of the directory . When backup is daily ran , you should see this .
Image may be NSFW.
Clik here to view.
Hope it Helps ,
Kenny Buntinx