Quantcast
Channel: System Center Configuration Manager » ConfigMgr 2007
Viewing all articles
Browse latest Browse all 10

Configmgr 2007 / 2012 : Using AfterBackup.bat to Daily Archive a Backup Snapshot

$
0
0

 

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

  1. Prepare an ASCII file with commands that archive your backup snapshot, or that perform any other post-backup tasks your site requires.
  2. 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.
  3. 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">&quot;%ArchiveDir%\7za.exe&quot;</span> a -r <span class="str">&quot;%ArchiveDir%\%date:~0,2%%date:~3,2%%date:~-4%.7z&quot;</span> <span class="str">&quot;%BackupDir%&quot;</span>

  1. Place the file in the following location :

3

  1. Make sure you copy the 7zip (command line executable) in the root of the directory . When backup is daily ran , you should see this .

2

 

Hope it Helps ,

Kenny Buntinx


Viewing all articles
Browse latest Browse all 10

Trending Articles