Setsitelock: Stsadm operation (Windows SharePoint Services)
Applies To: Windows SharePoint Services 3.0
Topic Last Modified: 2009-04-15
Description
Sets a value that specifies whether the site collection is locked and unavailable for read or write access. This operation should be used in conjunction with the Getsitelock operation. For more information, see the Examples section.
Important
In Service Pack 2 for SharePoint Products and Technologies, site collections are automatically locked as read-only before a backup process occurs. Therefore, there is no need to use the Setsitelock: Stsadm operation (Windows SharePoint Services) operation. If you do not want site collections to be locked as read-only, you must specify the nositelock parameter of the Backup: Stsadm operation (Windows SharePoint Services) operation that is available in Windows SharePoint Services 3.0 with Service Pack 2 (SP2).
Syntax
stsadm -o setsitelock
** -url <URL name>**
** -lock {none | noadditions | readonly | noaccess}**
Parameters
Parameter name | Value | Required? | Description |
---|---|---|---|
url |
A valid URL, such as http://server_name |
Yes |
The URL of the site collection. |
lock |
Any of the following values:
|
Yes |
Set the lock status of the site collection. |
Examples
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.
To determine the lock status of the site, you can use the following getsitelock syntax:
stsadm -o getsitelock -url https://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 https://server_name -lock noaccess
You can use the Backup operation to create a backup of the site collection:
stsadm -o backup -url https://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 https://server_name -lock none