Monday, December 10, 2012

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.
  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
Un-check "Select All" and Select Permissions which are starting 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 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.

# 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.
make sharepoint farm read-only
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:
  1.     Open SQL Server Management Studio.
  2.     Right-click the SharePoint content database and click Properties.
  3.     Go to 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.



You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Check out these SharePoint products:

3 comments :

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

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

      Delete
  2. 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.

    ReplyDelete

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...