Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
1 like 0 dislike
in SharePoint Server by 9 20 25
We have a web application that has about 100+ site collections and we need to lock them down.Is it possible to make the 100+ site collections read-only instead of manually?

1 Answer

1 like 0 dislike
by 9 20 25

To set several site collections to read-only mode use powershell

First, create a csv file that contains all sites URLs


Second, open powershell and run the below script

Add-PSSnapin Microsoft.SharePoint.PowerShell
$Sites = import-csv “c:\temp\SiteCollections.csv”
Foreach($Site in $Sites)
Write-Host”Set Readonly:” $Site.Url
Set-SPSite -Identity $Site.Url -LockState “ReadOnly”
If you don’t ask, the answer is always NO!