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 is an experienced Technical Program Manager with a passion for technology. He has architected and developed software for more than a decade for a broad range of industries. Diganta is a founder of two online IT businesses. He is a certified AWS Solutions Architect, AWS Certified Developer, Professional Scrum Master (PSM I), Professional Scrum Developer (PSD I) and ITIL Certified. He has presented at Microsoft Tech.Ed, Microsoft AppFest and Ark Group Intranet conference in the past. He attends AWS Seattle Official Events and Seattle AWS Architects-Engineers. He likes to help, mentor, and manage software development teams to improve and produce great software.

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.