0

Hi I have added 4 groups to site collection 'A' using the powershell script below. How can I add the same groups in a site under the site collection 'A'

   `$web=Get-SPWeb "http://sitecollectionurl"`
    $newGroup=$web.SiteGroups.Add($groupName,$web.Site.Owner,$web.Site.Owner,$description) 
    $group=$web.SiteGroups[$groupName] 
    $roleAssignment=New-Object Microsoft.SharePoint.SPRoleAssignment($group) 
    $roleDefinition=$web.RoleDefinitions[$permissionLevel] 
    $roleAssignment.RoleDefinitionBindings.Add($roleDefinition) 
    $web.RoleAssignments.Add($roleAssignment); 
    $web.Update() 
    $web.Dispose() 
4

Groups are created at the site collection level only.

It is only what permissions that group has in the sub site that is maintained (in a sub site with broken inheritance) in the sub site

See this for more information: http://social.msdn.microsoft.com/Forums/sharepoint/en-US/e6981b2b-924b-4b0c-bcb8-4f9748119170/add-new-group-to-subsites-programatically?forum=sharepointdevelopmentlegacy

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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