0

There are many document libraries in in sites instead of going each document library how can I write PowerShell to Break Permission Inheritance for all document libraries in a Site ,

1 Answer 1

0

This works for me (tested in SP 2013):

CLS
Add-PSSnapin Microsoft.SharePoint.PowerShell –ErrorAction SilentlyContinue
 
$libraryName="TestLibrary"

$site=Get-SPSite "http://webSPapplication.com/sites/helloSite"

$library=$site.RootWeb.Lists | where {$_.Title -eq $libraryName  }

$library.HasUniqueRoleAssignments

#keep all existing permissions and Item level permissions

$library.BreakRoleInheritance($True,$True)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.