Making a site read-only (also known lock) is required most of the time when you are going to migrate to newer version and restrict user for any modifications. This is most of the time required over cut over migration.
If you have to lock a web application read-only which contain multiple site collections then you have to mark each of them read-only.
There are four options for changing lock status of a site collection
- Read Only
- Not Locked
- Adding Content Prevented
- No Access
Check this link for more details on locking options
There are multiple ways to lock a site collection.
- Using SharePoint Central Admin
- Using PowerShell
- Using STSADM
Using SharePoint Central Admin
This is the easiest way to lock/unlock a site collection. Go to SharePoint Central Admin –> Application Management –> Site Collections –> and click on Configure Quotas and Locks
This will take you to the configure Quotas and lock page, change the site collection which you want to lock or unlock.
You can see four different options, select read-only if you want lock the site collection or select Not locked to unlock the site collection.
The above screenshots are from a SharePoint 2010 Farm, you can follow the similar steps to lock/ unlock sites on SharePoint 2007, SharePoint 2013 and SharePoint 2016.
SharePoint 2007
SharePoint 2016
Using PowerShell
You have seen four different options in above screenshots for different lock status. Below are the four PowerShell cmdlets to execute the similar functionality, this way is faster for SharePoint admins instead of going through central admin.
- Set-SPSite -Identity “http://sp2010/sites/site1” -LockState “ReadOnly”
- Set-SPSite -Identity “http:// sp2010/sites/site1” -LockState “Unlock”
- Set-SPSite -Identity “http:// sp2010/sites/site1” -LockState “NoAdditions”
- Set-SPSite -Identity “http:// sp2010/sites/site1” -LockState “NoAccess”
Using STSADM
I would recommend to using PowerShell cmdlets for locking / unlocking a site collection but if you are using SharePoint 2007 or WSS 3.0 (or older version) then you still use the central admin or can use below cmdlets
- Get site lock status: stsadm -o getsitelock -url http://sp2007
- Lock site: stsadm -o setsitelock -url http://sp2007-lock noaccess
- Remove site lock: stsadm -o setsitelock -url http://sp2007 -lock none
No Comments