Avatar of Tray896
Tray896
Flag for United States of America asked on

PowerShell script to set a large number of SharePoint 2013 site collections to "No Access" lock status

I have several hundred sites on my SharePoint 2013 farm that I need to set to "No Access" by locking the site collection.  What I would like to do, is use a PowerShell script to read the list of URL's from a text file, loop through each one, and lock the site collection.  This is what I have so far, but need some assistance on getting it completed:

Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
 
$Sites = Get-Content -Path e:\scripts\SitesToLock.txt
 
ForEach ($site in $Sites) 
{
  Set-SPSite -Identity $site.Url -LockState "NoAccess" }

Open in new window

PowershellMicrosoft SharePoint

Avatar of undefined
Last Comment
Tray896

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Alex

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Tray896

ASKER
Doh, thanks!
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes