I used the folowing stmt to add permissions to group:


gives following error

Exception calling "Add" with "1" argument(s): "This operation is not allowed on an object that inherits permissions."

Regards, any suggestions/help would be higly appreciated

Ketan Gandhi.


Try this function:

function Create-SPGroupInWeb
 param ($Url, $GroupName, $PermissionLevel, $Description)
 $web = Get-SPWeb -Identity $Url
 if ($web.SiteGroups[$GroupName] -ne $null)
  Write-Host "Group $GroupName already exists!" -foregroundcolor Red
  $web.SiteGroups.Add($GroupName, $web.Site.Owner, $web.Site.Owner, $Description)
  $group = $web.SiteGroups[$GroupName]
  $roleAssignment = new-object Microsoft.SharePoint.SPRoleAssignment($group)
  $roleDefinition = $web.Site.RootWeb.RoleDefinitions[$PermissionLevel]
  Write-Host "Group $GroupName created successfully" -foregroundcolor Green


For more information, you can visit http://snahta.blogspot.in/2012/02/powershell-and-sharepoint-permissions.html

  • I have already refered the same link and code...still giving me error. I am executing my code using Windows ISE
    – Ketan03
    Aug 17 '12 at 9:10

There needs to be a call to $web.BreakRoleInheritance(true) before adding any role assignments. The "true" means that it copies the existing permissions when it breaks inheritance, with false it starts with no permissions.

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.