Post

Unlock SharePoint Site Collections
You can lock or unlock SharePoint Site Collections manually but it’s also possible your Site Collection gets locked by SharePoint. A Site Collection backup for example locks the Site Collection during backup and this lock will remain in place if the backup could not be completed. Your Site Collection can also be in Maintenance Mode […]

You can lock or unlock SharePoint Site Collections manually but it’s also possible your Site Collection gets locked by SharePoint. A Site Collection backup for example locks the Site Collection during backup and this lock will remain in place if the backup could not be completed. Your Site Collection can also be in Maintenance Mode which makes it unable to set the state to “Not Locked” without PowerShell.

Which Site Collections are locked?

You can run the following script to find out in which state your Site Collection is

#Add PowerShell Snapin
Add-pssnapin Microsoft.SharePoint.Powershell -ErrorAction silentlycontinue

#Get all Site Collections
$SiteCollections = get-spsite -limit all

#Loop through all site collections
foreach($SiteCollection in $SiteCollections)
{
#Remove "SPSite Url=" from variable
$Url = $SiteCollection.url.Replace("SPSSite Url=","")

#Verify the properties from the Site Collection
if ($SiteCollection.ReadOnly -eq $false -and $SiteCollection.ReadLocked -eq $false -and $SiteCollection.WriteLocked -eq $false)
{
write-host "$Url : Unlocked" -foregroundcolor Green
}
elseif ($SiteCollection.ReadOnly -eq $false -and $SiteCollection.ReadLocked -eq $false -and $SiteCollection.WriteLocked -eq $true)
{
write-host "$Url : Adding content prevented" -foregroundcolor yellow
}
elseif ($SiteCollection.ReadOnly -eq $true -and $SiteCollection.ReadLocked -eq $false -and $SiteCollection.WriteLocked -eq $true)
{
write-host "$Url : Read-only" -foregroundcolor Red
}
elseif ($SiteCollection.ReadOnly -eq $null -and $SiteCollection.ReadLocked -eq $null -and $SiteCollection.WriteLocked -eq $null)
{
write-host "$Url : No access" -foregroundcolor yellow
}
elseif ($SiteCollection.MaintenanceMode -eq $true)
{
write-host "$Url : Maintenance Mode" -foregroundcolor red
}
}

Output

image

Unlocking the Site Collection

By Central Administration

1. Open Central Administration

2. Click on ‘Application Management’

3. Click on ‘Configure quotas and locks’

4. Navigate to the locked site collection

image

5. Unlock the Site Collection

image

6. Click on OK

By PowerShell

Run the following script to unlock a single Site Collection or add this line to the above script to unlock the site collection immediately.

Set-SPSite -Identity “<SiteCollection>” -LockState Unlock

image

Maintenance Mode

The following warning is viewable on the site when the Site Collection is in maintenance mode

clip_image002

and you are unable to modify the lock manually or with the normal PowerShell commands.

image

You can only disable maintenance mode for a Site Collection with PowerShell by running the following commands

$Admin =  new-object Microsoft.SharePoint.Administration.SPSiteAdministration(‘<SiteCollectionURL>’)
$Admin.ClearMaintenanceMode()

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Archive