Say you have a ton of subwebs in a sitecollection. Each web have unique permissions and unique groups.

You would like to update alle membergroups to have Contribute permissions, instead of Edit permissions. If you need to update all ownergroups or visitorgroups, just change the script accordingly.

You do it like this:

#Get the URL of your SiteCollection
$site = Get-SPSite

#Go through each site
foreach ($web in $site.AllWebs)
# Get the Member group of the current site
$group = $web.Groups | Where {$_.Name -Like 'Member*'}
echo $group.Name
$ra = $group.ParentWeb.RoleAssignments.GetAssignmentByPrincipal($group)

# Define the permissionlevel you wish to remove
$rd = $group.ParentWeb.RoleDefinitions["Contribute"]

# Define the permissionlevel you wish to add
$rd = $group.ParentWeb.RoleDefinitions["Edit"]



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.