Domanda

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 ,

È stato utile?

Soluzione

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)
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top