# Set site collection URL
$URL = http://xxxxx/
# Load SharePoint PowerShell snap-in
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
# Retrieve site collection
$sc = Get-SPSite $URL
# Enumerate site collection and reset permissions on all subsites and lists
ForEach ($web in $sc.AllWebs) {
If ($web.Url -ne $URL) {
$ws = Get-SPWeb $web.Url
"Resetting subsite inheritance: $($ws.Url)"
$ws.ResetRoleInheritance()
$ws.Update()
$ws.Dispose()
}
# Reset list permissions
$lc = $web.Lists
ForEach ($list in $lc) {
"Resetting list inheritance: $($list.Title)"
$list.ResetRoleInheritance()
$list.Update()
}
}
0 reacties:
Een reactie posten