How to create a batch file to do automatic backup of SharePoint site?
Suppose you have a SharePoint site with some heavy and important data and you want to take the backup regularly. So instead of manual process you can create a batch file which will automatically take the backup of the mentioned site.
Below is the given script:
Write below code in a notepad and save it as .bat file.
@echo off
@echo
@echo This script will backup your site: [Enterprise Management Site]
@echo
cd C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN
@echo locking site collection before the backup process starts
@echo off
stsadm -o getsitelock -url http://moss-server:333/
stsadm -o setsitelock -url http://moss-server:333/ -lock readonly
@echo site collection is now locked
@echo off
stsadm -o backup -url http://moss-server:333/ -filename C:\RRSbackup\autobackup.bak -overwrite @echo backup completed
@echo off
stsadm -o setsitelock -url http://moss-server:333/ -lock none
@echo Site lock removed
Once you ready with your batch file then you can put this batch file in a scheduler and define a time to run this batch file.
Below is the given script:
Write below code in a notepad and save it as .bat file.
@echo off
@echo
@echo This script will backup your site: [Enterprise Management Site]
@echo
cd C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN
@echo locking site collection before the backup process starts
@echo off
stsadm -o getsitelock -url http://moss-server:333/
stsadm -o setsitelock -url http://moss-server:333/ -lock readonly
@echo site collection is now locked
@echo off
stsadm -o backup -url http://moss-server:333/ -filename C:\RRSbackup\autobackup.bak -overwrite @echo backup completed
@echo off
stsadm -o setsitelock -url http://moss-server:333/ -lock none
@echo Site lock removed
Once you ready with your batch file then you can put this batch file in a scheduler and define a time to run this batch file.
Comments
Post a Comment
Dear Readers, Please post your valuable feedback in the comment section if you like this blog or if you have any suggestions. I would love to hear the same from you. Thanks