Saturday, December 8, 2007

Backup Script fo MOSS 2007

MOSS have some out of box backup/restore functionality, but doesnt have scheduer. So I have created batch file with using of STSADM feature. You can schedule this file in Windows Scheduler, it will generate filename with datestamp. Here is the script

@echo off
echo ====================================================
echo Ful Backup Script For Office SharePoint Server 2007
echo ====================================================
cd \Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN
@echo off
@For /F "tokens=2 delims=/ " %%A in ('Date /t') do set DAY=%%A
@For /F "tokens=3 delims=/ " %%B in ('Date /t') do set MONTH=%%B
@For /F "tokens=4 delims=/ " %%C in ('Date /t') do set YEAR=%%C
Set CUSTOMDATE=%YEAR%-%MONTH%-%DAY%
stsadm.exe -o backup -url http://portal -filename E:\Backupsharpoint\portal_%CUSTOMDATE%.bak -backupmethod full -overwrite

@echo off
cd\
echo completed

0 comments:

Post a Comment