locked
How to make read only mode for all the site collections under single web application - SharePoint 2013 & MOSS 2007 RRS feed

  • Question

  • Hi All,

    I want to make all the site collections in the web application to read-only mode on MOSS 2007 & SharePoint 2013. Can anyone tell me how to achieve this ?

    Thanks & Regards,
    Sankar
    Thursday, December 3, 2015 7:05 AM

Answers

  • $sites = Get-SPWebApplication http://<site name> | Get-SPSite -Limit All
    foreach ($site in $sites)

    {

    $site.readonly = $true

    }


    sachin

    • Marked as answer by SK1205 Saturday, December 5, 2015 1:24 AM
    Friday, December 4, 2015 6:29 PM
  • $sites = Get-SPWebApplication http://<site name> | Get-SPSite -Limit All
    foreach ($site in $sites)

    {

    $site.readonly = $false

    }


    sachin

    • Marked as answer by SK1205 Saturday, December 5, 2015 1:24 AM
    Saturday, December 5, 2015 12:27 AM

All replies

  • Yes you can make the site collection ready .there is one setting in central admin. make the database ready only.

    https://technet.microsoft.com/en-us/library/cc263238.aspx

    Option Description

    Not locked

    .

    Adding content prevented

    .

    Read-only (blocks additions, updates, and deletions)

    No access

    .


    Yogesh Sainee

    Friday, December 4, 2015 11:51 AM
  • Hi Yogesh,

    Thanks for your reply.

    However we need to do this changes from web application level through scripts.

    Thanks & Regards,
    Sankar

    Friday, December 4, 2015 3:18 PM
  • $sites = Get-SPWebApplication http://<site name> | Get-SPSite -Limit All
    foreach ($site in $sites)

    {

    $site.readonly = $true

    }


    sachin

    • Marked as answer by SK1205 Saturday, December 5, 2015 1:24 AM
    Friday, December 4, 2015 6:29 PM
  • Hi,

    Thanks for the script.
    And to unlock do i need to use "Unlock" command ?

    Ex:

    $sites = Get-SPWebApplication http://<site name> | Get-SPSite -Limit All
    foreach ($site in $sites)

    {

    $site.Unlock = $true

    }

    Thanks & Regards,
    Sankar
    Saturday, December 5, 2015 12:06 AM
  • $sites = Get-SPWebApplication http://<site name> | Get-SPSite -Limit All
    foreach ($site in $sites)

    {

    $site.readonly = $false

    }


    sachin

    • Marked as answer by SK1205 Saturday, December 5, 2015 1:24 AM
    Saturday, December 5, 2015 12:27 AM
  • Hi,

    Thanks so much.
    Also can you guide me how to apply these changes on MOSS 2007 ?

    Thanks & Regards,
    Sankar
    Saturday, December 5, 2015 1:24 AM