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.

  1. Using SharePoint Central Admin
  2. Using PowerShell
  3. 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

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.

Configure Quotas and Locks - SharePoint 2010

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

Configure Quotas and Locks - SharePoint 2007

SharePoint 2016

Configure Quotas and Locks - 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

Adnan is six time Microsoft MVP (Since 2015) with over 16 years of extensive experience with major expertise on SharePoint, SharePoint based development, Microsoft 365, Microsoft Teams, .Net Platform and Microsoft BI. He is currently working Sr Microsoft Consultant at Olive + Goose. He is MCT Regional Lead for Pakistan Chapter since 2012. He is working on SharePoint for past 12 years and worked on different intranet/intranet solutions for private & govt. sector majorly in United states and Gulf region and have experience of working with multiple Fortune 500 companies. He is a trainer, technology evangelist and also speaks in community forums.

Leave a Reply