Script to make unlock the sites from particualr db

sns 9,226 Reputation points
2021-04-21T05:56:02.337+00:00

Particular db has sites, in this db site status are read only in sharepoint
I want to unlock all sites from that db. Please help me with script. Thank you.

SharePoint Server Management
SharePoint Server Management
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Management: The act or process of organizing, handling, directing or controlling something.
2,799 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jerry Xu-MSFT 7,921 Reputation points
    2021-04-22T02:32:19.833+00:00

    Hi, @sns ,

    You can use the following script to unlock sites from certain database.

    $db=Get-SPContentDatabase | where-object {$_.Name -eq '<Content Database Name>'}  
    $sites=Get-SPSite -ContentDatabase $db.id  
    foreach($site in $sites)  
    	{  
    		Set-SPSite -Identity $site.URL -LockState Unlock  
    	}  
    

    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful