I am trying to remove permissions from a folder and then add new ones.

My script adds the permissions successfully but when I try and get rid of the permissions it inherited it's just not working, it just adds the new permissions on to it.

I am adding to a document library in Office 365

Write-Host "inheritance reset"
Write-host "Inheritance Broken"

$global:test =$true

if($isgroup -eq $true){
      $groups = $web.SiteGroups



      $group = $groups | where {$_.Title -eq $groupAD}

      domainUser = $groups -replace '\\', '/'
      $fullUserName = ([adsi]"WinNT://$domainUser,user").fullname
      $groups = [string]$fullUserName
      if($groups -eq ''){
           $groups = "Rob Ireland"
      $group = $Context.Web.EnsureUser($groups)

$collRdb = new-object Microsoft.SharePoint.Client.RoleDefinitionBindingCollection($context)                                
$collRoleAssign = $item.RoleAssignments                               
$rollAssign = $collRoleAssign.Add($group, $collRdb)
Write-host "$Permission have been added at $folderName for $groups"  

1 Answer 1




You will have to specify the first parameter as False, which means all the permissions from the parent will not be copied over. See the documentation for BreakRoleInheritance .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.