Create a Custom Permission Level Using PowerShell Script

If I as a client tell u, I need a custom permission level within minutes what will You Do? Involve more resources to set up custom levels. Here it is a quick way.

First see what kind of permissions you want that custom level to have.

Choose from the following:

  • ViewListItems
  • AddListItems
  • EditListItemsDeleteListItems
  • ApproveItems
  • OpenItems
  • ViewVersions
  • DeleteVersions
  • CancelCheckout
  • ManagePersonalViews
  • ManageLists
  • ViewFormPages
  • Open
  • ViewPages
  • AddAndCustomizePages
  • ApplyThemeAndBorder
  • ApplyStyleSheets
  • ViewUsageData
  • CreateSSCSite
  • ManageSubwebs
  • CreateGroups
  • ManagePermissions
  • BrowseDirectories
  • BrowseUserInfo
  • AddDelPrivateWebParts
  • UpdatePersonalWebParts
  • ManageWeb
  • UseClientIntegration
  • UseRemoteAPIs
  • ManageAlerts
  • CreateAlerts
  • EditMyUserInfo

Now here comes the script,

Add the permissions you want to the script.

Powershell Script:

  1. $site=Get-SPSite "My Site Name Here"  
  2. $web=$site.RootWeb;  
  3. $customPermissionLevel=New-Object Microsoft.SharePoint.SPRoleDefinition  
  4. $customPermissionLevel.Name="Custom Permission in SharePoint"  
  5. $customPermissionLevel.Description="Description: This is a Testing"  
  6. $customPermissionLevel.BasePermissions="EmptyMask,  
  7. ViewListItems,  
  8. AddListItems,  
  9. EditListItems,  
  10. DeleteListItems,  
  11. ApproveItems,  
  12. OpenItems,  
  13. ViewVersions,  
  14. DeleteVersions,  
  15. CancelCheckout,  
  16. ManagePersonalViews,  
  17. ManageLists,  
  18. ViewFormPages,  
Open,
  1. ViewPages,  
  2. AddAndCustomizePages,  
  3. ApplyThemeAndBorder,  
  4. ApplyStyleSheets,  
  5. ViewUsageData,  
  6. CreateSSCSite,  
  7. ManageSubwebs,  
  8. CreateGroups,  
  9. ManagePermissions,  
  10. BrowseDirectories,  
  11. BrowseUserInfo,  
  12. AddDelPrivateWebParts,  
  13. UpdatePersonalWebParts,  
  14. ManageWeb,  
  15. UseClientIntegration,  
  16. UseRemoteAPIs,  
  17. ManageAlerts,  
  18. CreateAlerts,  
  19. EditMyUserInfo,  
  20. EnumeratePermissions,  
  21. FullMask"  
  22.   
  23. $web.RoleDefinitions.Add($customPermissionLevel);  
  24. $web.Dispose()  
  25. $site.Dispose()  

  • Click on Start > Right click on SharePoint 2010 Management Shell and run as Administrator.
  • Paste the above code
  • Click enter
  • Go to the site > Site Settings> Permission Levels
  • You will find the below Custom Permission level Created named “Custom Permissions in SharePoint

custom label

On clicking on the custom level you will see the below permissions added to the level.

permissions added to the level

select option

Quick isn’t it?

Keep Learning,

Cheers.

Ebook Download
View all
Learn
View all