SharePoint SiteCollection back script

1. Copy and paste the text below in a notepad and save as a bat file.
2. Setup Windows schedular to run the bat file overnight.
3. Check logs files under ‘C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\LOGS’.
Note: The log file uses the ServerName-Date-Time.log format. Open and look for STSADM.EXE.

@echo off
echo ===============================================================
echo Backup Sharepoint Site Collection onto “D:\backup\SiteCollectionBackup.Dat”
echo ===============================================================
@echo off
::*****Change Directory to the 12 Hives*****
cd C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN
::*****Limit access to the site collection during backup*****
stsadm.exe -o setsitelock -url -lock readonly
::*****Back up the site collection*****
stsadm.exe -o backup -url -filename \\SERVERNAME\D$\backup\SiteCollectionBackup.Dat -overwrite
::*****Back up the farm*****
stsadm.exe -o backup -directory “D:\backup\Farm” -backupmethod full
::*****Remove lock on Limit access to the site collection during backup*****
stsadm.exe -o setsitelock -url -lock none
echo completed


Diganta Kumar has architected and developed software for more than a decade for a wide range of industries and development platforms and over the years has filled many roles including program manager, founder, developer, architect, team lead, mentor and project manager. Diganta is founder of two online IT businesses. He is a certified AWS Solutions Architect, certified Professional Scrum Master (PSM I), certified Professional Scrum Developer (PSD I) and ITIL Certified. He has presented at Microsoft Tech.Ed, Microsoft AppFest and Ark Group Intranet conference. He attends AWS Seattle Official Events, Seattle AWS Architects-Engineers, and AWS Cloud Commerce user groups. He likes to help, mentor and manage software development teams to improve and produce great software. He currently work as a Senior Technical Program Manager for Amazon Web Services.

Tagged with:
Posted in SharePoint

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s