Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue
- $webUrl = "https://sharepoint.DOMAIN.com/";
- $web = Get-SPWeb $webUrl;
- $oList=$web.Lists["General Documents"];
- foreach($folder in $oList.Folders) {
- if($folder.Name -eq "Accounting Department") {
- $query = New-Object Microsoft.SharePoint.SPQuery;
- #$query.Query = "<Where><Eq><FieldRef Name='FSObjType'/><Value Type='Lookup'>1</Value></Eq></Where>";
- $query.Folder = $folder.Folder;
- $query.ViewAttributes = "Scope='RecursiveAll'";
- $folderItems = $olist.GetItems($query)
- foreach($item in $folderItems) {
- if($item.HasUniqueRoleAssignments) {
- Write-Host "Inheritance needs to be reset on" $item.url
- #$item.ResetRoleInheritance()
- #$item.Update()
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement