Stsadm commands for backup, restore, and locking site

Use stsadm to lock a SharePoint site prior to backup.
Refer: msft articleExamples

A common situation where the getsitelock and setsitelock operations are useful is when a site is backed up. Typically, before you back up a site collection, the site should be locked and no users should have access to it.

Lock Site
To determine the lock status of the site, you can use the following getsitelock syntax:
stsadm -o getsitelock -url http://server_name

Once the lock status of the site collection is determined, you can use the noaccess parameter of the setsitelock operation to lock out all users to the site:

stsadm -o setsitelock -url http://server_name -lock noaccess

You can also use the following command to put the site into "read only" access:

stsadm -o setsitelock -url http://server_name -lock readonly

Backup Site
You can use the Backup operation to create a backup of the site collection:
stsadm -o backup -url http://server_name -filename "filename.bak" -overwrite

After the site has been backed up, you can use the none parameter of the setsitelock operation to remove all locks to the site:

stsadm -o setsitelock -url http://server_name -lock none

Restore Site
stsadm -o restore -url http://w2k3vpc -filename filename.bak -overwrite

Delete Site
stsadm -o deletesite -url http://w2k3vpc

Manage Server Farm with Scripts
sharepoint-buildout-farm-scripts

Enumeration / Details
"C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN\STSADM.EXE" -o enumsubwebs -url http://efleet

"C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN\STSADM.EXE" -o enumsites -url http://efleet

Leave a Reply