SharePoint Services 3.0 Command Line Backup Script With 7 Day Full Retention and Email Reporting

This backup script fully backs up your SharePoint Services 3.0 site to a specified location and keeps copies of backups for 7 days. You'll have to set the variables at the top of the script, then schedule it to run with the windows task scheduler, and then you're off!

Oh, and you'll need blat.exe - you can download it directly from me if you like here. OR Google it if you don't trust me.

location - Location you want your backups to be stored.
blat - Location of blat.exe
relayserver - An email server you have relay access to.
yourserver - Your SharePoint site's URL.
templog - Temp location logs are stored before being emailed.
file - Name of the SharePoint backup files that will be created.
to - Who the email reports go to.
who - Who the email should come from.
reply - Where email replies should go.


echo SharePoint Services 3 7 Day Command Line Backup Script Version 1

set location=d:\sharepoint\backup
set blat=c:\windows\system32\blat.exe
set yoursite=
set emailsub=SharePointBackupReport
set templog=c:\batch\spbackup.txt
set file=Backup.bak

del %location%\%file%.7day
rename %location%\%file%.6day %file%.7day
rename %location%\%file%.5day %file%.6day
rename %location%\%file%.4day %file%.5day
rename %location%\%file%.3day %file%.4day
rename %location%\%file%.2day %file%.3day
rename %location%\%file%.1day %file%.2day
rename %location%\%file% %file%.1day
"C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN\Stsadm.exe" -o backup -overwrite -url %yoursite% -backupmethod full -filename %location%\%file% > %templog%
dir %location% >> %templog%
%blat% "%templog%" -t %to% -s "%emailsub%" -i %who% -f "%reply%" -q -server "%relayserver%"

Please comment any problems you have so we can get this baby just right!