SharePoint 2013: Set Site Collection to Read Only

At times we may require to set site collections to read-only to prevent any add/edit/delete operations on the site’s content. During a SharePoint migration we decided to set sites to read only to restrict any updates. How to set site collection to read only in SharePoint 2013?

Set SharePoint 2013 site collection to read using Central Administration:

Usually making SharePoint 2013 site collections to read only is done at SharePoint Central administration site.

  • Go to Central Administration >> Select Application Management  >> Configure quotas and locks
  • Choose the site collection you want to set on Read-only mode and select the option “Read-Only”. Choose farm administrator controlled or site collection administrator controlled options accordingly.
  • Enter the lock information and click “OK”

Fortunately, Unlike its previous versions, SharePoint 2013 displays a banner “This site is read only at the farm administrator’s request” to notify end users – when site collections are in read-only mode!

sharepoint 2013 set site collection read only

Once sites are read-only, you may notice certain controls on ribbons, menus are disabled. But site content can be accessed as usual.

Set Site Collection Read Only with PowerShell

We can make SharePoint site read only using PowerShell. Open SharePoint Management Shell. Enter following command:

Set-SPSite -Identity "Site-Collection-URL" -LockState "ReadOnly"

How to set all SharePoint sites to Read-only?

Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue

#Get all Site Collections
$SitesColl = Get-SPSite -limit All

#Loop through all site collections
ForEach($Site in $SitesColl)
{
  Set-SPSite -Identity $site.Url -LockState "ReadOnly"
  #You can also use: Set-SPSiteAdministration -LockState "ReadOnly" -Identity $Site.URL
}

Unlocking SharePoint 2013 read only site collections

To revert the Read only mode, Return to the SharePoint Central Administration’s Site collection Quotas and Locks page and choose “Not locked”. We can unlock the site collection using PowerShell by entering the command:

Set-SPSite -Identity "Site-Collection-URL" -LockState "Unlock"

You can use STSADM also to set SharePoint 2013 site in read only mode
To make a SharePoint site read-only, Enter:
Stsadm -o SetSiteLock -url “Site-Collection-URL” -lock ReadOnly

To undo read-only, use:
Stsadm -o SetSiteLock -url “Site-Collection-URL” -lock none
SharePoint site locks are explained in my another article: Site Collection Locks in SharePoint

Tips: If your site is read-only and you couldn’t unlock it, your site may be in maintenance mode. Some times, SharePoint 2013 sites goes in read only mode after an interrupted backup. Try above methods to unlock. If they fail, You have to clear maintenance mode to revert read only: Maintenance Mode in SharePoint 2013

Its also possible to make sites to read only using SharePoint Server Object Model: SPSite.ReadOnly = true. Setting up sites to read-only can be done at SQL Server also at content database level.

To make the web application or entire farm to Read only, refer: Set SharePoint Web Application or Farm to Read Only Mode

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

4 thoughts on “SharePoint 2013: Set Site Collection to Read Only

  • May 4, 2021 at 8:38 PM

    This site has pretty much become a one-stop shop for me. Great work Salaudeen!

    I have a question about the script on this page. I set all of the sites to read only for a maintenance window using this script, but when I went to unlock them, it skipped 150 sites that have spaces in the URL. I get this error:

    $SPSite = get-spsite $Site
    ~~~~~~~~~~~~~~~~
    CategoryInfo : InvalidData: (Microsoft.Share…SPCmdletGetSite:SPCmdletGetSite) [Get-SPSite],
    SPCmdletPipeBindException
    FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletGetSite
    >> ParameterBinding(Trace-SteroidsOutput): name=”InputObject”; value=”Cannot find an SPSite object with Id or Url: “https://customsolutions.domain.com/sites/LastName, FirstName MiddleName”.”
    get-spsite : Cannot find an SPSite object with Id or Url:
    “https://customsolutions.domain.com/sites/LastName, FirstName MiddleName”.
    At C:UsersMeDocumentsWindowsPowerShellScriptsSet-SiteLock&LockIssue.ps1:28 char:13
    $SPSite = get-spsite $Site
    ~~~~~~~~~~~~~~~~
    CategoryInfo : InvalidData: (Microsoft.Share…SPCmdletGetSite:SPCmdletGetSite) [
    Get-SPSite], SPCmdletPipeBindException
    FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletGetSite

    Any way around this?

    Reply
  • November 28, 2018 at 2:29 PM

    How do we change the Read only banner at the top? I thought that the message in central admin when you lock the site would do the trick, but we still have the boring “This site is read only at the farm administrator’s request.”

    Reply
  • August 24, 2017 at 5:55 PM

    I want to set site to ‘site admin controlled read only’ using powershell but it is setting it in farm admin controlled read only by default. Through UI I can change but how to do it through powershell

    Reply
  • December 5, 2015 at 12:06 AM

    Wow, I’ve used two of your scripts today! Thanks for posting. Adding your site to my SharePoint Favorites.

    Reply

Leave a Reply