magritton
1/15/2016 - 6:46 PM

This powershell script removes groups from all the sub sites where the sub site group equals a value. Use this when you want to remove a gro

This powershell script removes groups from all the sub sites where the sub site group equals a value. Use this when you want to remove a group from many subsites at the same time.

$topSite = Get-SPWeb http://scushp01/Branches/Auburn
$topSite.BreakRoleInheritance($false)
foreach($r in $topSite.RoleAssignments){
    if($r.Member.Name -eq "TheSound Visitors")
    {
        Write-Host "Removing.." + $r.Member.Name -ForegroundColor DarkGreen -BackgroundColor Yellow
        #$topSite.RoleAssignments.Remove($r)
    }
    else{
        $r.Member.Name
    }
    
}