To Set Read Only Mode:
# Get the Web Application
$WebApp=Get-SPWebApplication "http://mywebsite"
#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 "Lock" -Identity $SPsite.url
}
To Revert Back
# Get the Web Application
$WebApp=Get-SPWebApplication "http://mywebsite"
#Loop through all site collections and Set read only status
foreach ($SPsite in $webApp.Sites)
{
$SPsite.ReadOnly = $false
#Or you can use: Set-SPSiteAdministration -LockState "Unlock" -Identity $SPsite.url
}
No comments:
Post a Comment