Our current SCCM backup is targeted to DFS share pointed to our backup server. We dump files to this share and the local files are backed up to tape (really to disk then replicated to tape.) I never sat down and figured out how to get multiple backups rotating in SCCM until I saw this post. It reminded me that I needed to setup an afterbackup.bat script. If you add a script named afterbackup.bat to c:\Program Files\Microsoft Configuration Manager\inboxes\smsbkup.box (or where ever you installed it), it will be executed after the backup is finished. I added the following code to afterbackup.bat
setlocal enabledelayedexpansion set target=\\Network\DFS\BACKUP\SCCM\%date:~0,3% If not exist %target% goto datamove RD %target% /s /q :datamove move "\\Network\DFS\Backup\SCCM\Current" "%target%"
All this 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.
To test, I started the SMS_STIE_BACKUP service, and in the SCCM logs, I see :
SMS Site Backup task is starting.
SMS Site Backup is starting to copy the files from the snapshot.
SMS Site Backup successfully initiated command file “afterbackup.bat”.
Now I see a folder named “Tues” that contains last night’s backup.
Scratch that off the todo list. Finally.