Member 14904616 Ответов: 0

Удалить уникальные разрешения от дочернего узла и удалить дочерний узел в SharePoint


I need to delete unique permissions from a subsite and delete subsite... But while breaking the  inheritance the permissions are getting changed and thepermissions are intact at the root level

How can i delete the permission retreving the permissions with subsite title from the root site and delete them?


$web = Get-SPWeb $ssite 
    if($web){
     #Reset broken inheritance
      $web.ResetRoleInheritance()
        # Check if web has Unique permission - Root webs always uses Unique permission 
        if (($web.HasUniqueRoleAssignments) -and ($web.IsRootWeb -eq $false)){ 
              <#foreach($roleAssignment in $web.RoleAssignments){ 
                         $group = $web.SiteGroups[$roleAssignment.Member.Name];
                         $web.SiteGroups.Remove($group)
                         $web.Update();
                         Write-Host "Group Deleted-" $group -ForegroundColor Green 
             }#foreach    #>
             for($i=$web.RoleAssignments.Count-1;$i -ge 0; $i--){ 
                                Write-Host($web.RoleAssignments[$i].Member.Name);
                                $group = $web.SiteGroups[$web.RoleAssignments[$i].Member.Name];
                               	$web.RoleAssignments.Remove($group);
								$web.Update();
                                Write-Host "Group Deleted-" $group -ForegroundColor Green 
                    }   

        }#if
        else{Write-host "Site doesn't have any unique permissions " $web.URL -ForegroundColor Red }
        $web.Dispose()
    }#if


Что я уже пробовал:

delete unique permissions from a subsite and delete subsite


$web = Get-SPWeb $ssite 
    if($web){
     #Reset broken inheritance
      $web.ResetRoleInheritance()
        # Check if web has Unique permission - Root webs always uses Unique permission 
        if (($web.HasUniqueRoleAssignments) -and ($web.IsRootWeb -eq $false)){ 
              <#foreach($roleAssignment in $web.RoleAssignments){ 
                         $group = $web.SiteGroups[$roleAssignment.Member.Name];
                         $web.SiteGroups.Remove($group)
                         $web.Update();
                         Write-Host "Group Deleted-" $group -ForegroundColor Green 
             }#foreach    #>
             for($i=$web.RoleAssignments.Count-1;$i -ge 0; $i--){ 
                                Write-Host($web.RoleAssignments[$i].Member.Name);
                                $group = $web.SiteGroups[$web.RoleAssignments[$i].Member.Name];
                               	$web.RoleAssignments.Remove($group);
								$web.Update();
                                Write-Host "Group Deleted-" $group -ForegroundColor Green 
                    }   

0 Ответов