Set SharePoint Web Application or Farm to Read Only Mode
During maintenance/migrations, its 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've these options available to set read only access to either SharePoint Web Application or Farm.
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"

Un-check "Select All" and Select Permissions which are starting with "Open, View, Browse". such as: View Items, Open Items, Browse User Information.
This will make the selected web application to 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 straight forward. Since, Its possible to set the site collection to read-only mode using PowerShell, We can loop through the 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:
For More info on Site collection locks, refer 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.
or you can use the PowerShell one liner to retrieve all content databases of the web application:
Get-SPContentDatabase -WebApplication "http://SharePoint.company.com" | Select Name
You can repeat it for all web application to make entire SharePoint 2007 to SharePoint 2010 farm read only.
Make 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:
- Using Central Administration user permissions
- Set read-only mode for all site collections of the web application through PowerShell
- 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"

Un-check "Select All" and Select Permissions which are starting with "Open, View, Browse". such as: View Items, Open Items, Browse User Information.

This will make the selected web application to 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 straight forward. Since, Its possible to set the site collection to read-only mode using PowerShell, We can loop through the 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 "http://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 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.

or you can use the PowerShell one liner to retrieve all content databases of the web application:
Get-SPContentDatabase -WebApplication "http://SharePoint.company.com" | Select Name
You can repeat it for all web application to make entire SharePoint 2007 to SharePoint 2010 farm read only.
Make 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:
- Open SQL Server Management Studio.
- Right-click the SharePoint content database and click Properties.
- Go to Options tab and in the Other options list, scroll to the State section.
- Set the Database Read-Only row to True, and then click OK.
- Repeat this for all content databases of the web application
Bad advice, setting content DBs to read only in SQL will break timer jobs.
ReplyDeleteBad advice? Oops, then what Microsoft says about this, is bad!! Refer here:
Deletehttp://technet.microsoft.com/library/ff607663%28office.14%29.aspx
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.
ReplyDeletecontent db offline in CA does not mean that db goes to read-only mode. It just prevents creating new site collections.
ReplyDelete