Link to home
Start Free TrialLog in
Avatar of Tray896
Tray896Flag 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

ASKER CERTIFIED SOLUTION
Avatar of Alex
Alex
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tray896

ASKER

Doh, thanks!