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 is an experienced Technical Program Manager with a passion for technology. He has architected and developed software for over a decade for a broad range of industries. Diganta is a founder of two online IT businesses. He likes to help, mentor, and manage software development teams to improve and produce great software. He currently works as a Principal Program Manager for Microsoft. Before joining Microsoft, he was with AWS for five years, where he managed large cross-functional programs on a global scale.

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 )

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.

%d bloggers like this: