I am doing the following using powershell.

I am creating a site collection with 4 subsites and 5 custom groups.

Site Collection : Parent Child Site : One Child Site : Two Child Site : Three

There are four groups :

Group A, B, C, D

Access for the sites is as follows :

Child Site One : Group A, B, C, D (All groups have approve access) Child Site Two : Group A, B, D (All groups have approve access) Child Site Three : Group A, B, C (All groups have approve access)

I am creating all this in a powershell script.

How do I set the groups permission in a powershell script for the sitecollection and subsite? I understand that on the front end I can select the group within the site and break inheritance and then "Remove the Permissions" and this removes the group from the child site. How do I do this in powershell as this needs to be scripted.

PS Child Site Three/ Two each have a group that have no access.

1 Answer 1


To break inheritance on a site and give permissions to the groups you can use this code:


$roleDefinition = $web.Site.RootWeb.RoleDefinitions["Approve"]

$groupAssignmentA = new-object Microsoft.SharePoint.SPRoleAssignment($groupA)

$groupAssignmentB = new-object Microsoft.SharePoint.SPRoleAssignment($groupB)

$groupAssignmentC = new-object Microsoft.SharePoint.SPRoleAssignment($groupC)


Where $web is the subsite you want to give the permissions and $groupA, $groupB and $groupC an instance of the corresponding SPGroup.

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.