SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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