I want to remove all unique permissions on one site from all locations on it, whether they are lists, libraries, list items, folders or docs in libraries. All unique permissions must be removed.
I found PS script to delete unique permissions on lists or on site, but that's it, no examples to remove from all locations.
scripts I found are bellow:
for site:
$WebURL ="#"
$web = Get-SPWeb $WebURL
if ( ($web.HasUniqueRoleAssignments) -and ($web.IsRootWeb -eq $false ) )
{
$web.ResetRoleInheritance()
Write-host "Broken Inheritance Reset on web:" $web.URL
}
for list:
$WebURL ="#"
$Web = Get-SPWeb $WebURL
$ListColl = $web.lists | Where-Object
{
($_.HasUniqueRoleAssignments -eq $true) -and ($_.hidden -eq $false)
}
foreach($list in $ListColl) #if($list) #Exists
{
$list.ResetRoleInheritance()
Write-host "Broken Inheritance Reset on List:" $list.Title
}
Any help?