Set SharePoint Web Application or Farm to Read Only Mode

During maintenance/migrations, it’s inevitable to set the entire SharePoint Farm or at least Web Applications to read-only mode for some time. SharePoint doesn’t provide any direct ways to set the entire web application or Farm to Read-only mode, but we have these options available to set read only access to either SharePoint Web Application or Farm.

  1. Using Central Administration user permissions
  2. Set read-only mode for all site collections of the web application through PowerShell.
  3. Set all SharePoint content databases of the web application to read-only mode.

Option 1: Using Central Administration User Permissions to Make SharePoint web application read only:
Go to Central Administration >> Application Management >> Manage web Applications >> and select “User Permissions”
sharepoint web application read only
Uncheck “Select All” and Select Permissions which start with “Open, View, Browse”. Such as: View Items, Open Items, Browse User Information.
sharepoint 2010 web application read only

This will make the selected web application read-only.

Option 2: Set read-only mode for all site collections of the web application through PowerShell To set SharePoint 2010 web application read only
Using SharePoint Central Administration, We can set the lock for a particular site collection, which is straightforward. Since, It’s possible to set the site collection to read-only mode using PowerShell, We can loop through each and every site collection in the web application and set the site collection’s status to read-only. Once done with the migration/maintenance, you can unlock the sites again.

Make SharePoint Web Application to Read only using PowerShell:

# Get the Web Application
$WebApp=Get-SPWebApplication "https://SharePoint.company.com"

#Loop through all site collections and Set read only status
foreach ($SPsite in $webApp.Sites)
{
    $SPsite.ReadOnly = $true
    #Or you can use: Set-SPSiteAdministration -LockState "Unlock" -Identity $SPsite.url
}

For More info on Site collection locks, refer to my post: Site Collection Locks in SharePoint

Option 3. Set all SharePoint content databases of the web application to read-only mode
Get the Content Databases Associated with the web application. Go to:

Central Administration >> Application Management >> Manage Content Databases >> Select the desired web application and make a note of all content databases.
make sharepoint farm read-only
Or you can use the PowerShell one-liner to retrieve all content databases of the web application:

You can repeat it for all web applications to make the entire SharePoint 2007 to SharePoint 2010 farm read-only.

 Get-SPContentDatabase -WebApplication "https://SharePoint.company.com" | Select Name

Make the web app read only by setting all content databases to read only Mode
To set content databases to be read-only using SQL Server Management Studio:

  1.     Open SQL Server Management Studio.
  2.     Right-click the SharePoint content database and click Properties.
  3.     Go to the Options tab, and in the Other options list, scroll to the State section.
  4.     Set the Database Read-Only row to True, and then click OK.
  5.     Repeat this for all content databases of the web application
sharepoint 2010 or sharepoint 2007 web application read only

You can do this for all web applications to make SharePoint farm read-only.

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

4 thoughts on “Set SharePoint Web Application or Farm to Read Only Mode

  • content db offline in CA does not mean that db goes to read-only mode. It just prevents creating new site collections.

    Reply
  • Why not just set all the content database status to Offline in central admin? setting it to read only in sql will cause issue with updates.

    Reply
  • Bad advice, setting content DBs to read only in SQL will break timer jobs.

    Reply
    • Bad advice? Oops, then what Microsoft says about this, is bad!! Refer here:
      https://technet.microsoft.com/library/ff607663%28office.14%29.aspx

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *