PowerShell to Break Permission Inheritance for all document libraries in a Site
-
17-02-2021 - |
Pregunta
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 ,
Solución
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)
Licenciado bajo: CC-BY-SA con atribución
No afiliado a sharepoint.stackexchange