How to Delete a Permission Level in SharePoint using PowerShell?
Requirement: PowerShell to remove a permission level in SharePoint
How to remove a permission level in SharePoint?
In this blog post, we will walk you through how to delete a permission level in SharePoint. Deleting a permission level can be helpful if you want to simplify your permissions structure or if you no longer need the permission level. We will show you how to delete a permission level in SharePoint using PowerShell.
To delete a permission level in SharePoint, follow these steps:
- Login to your SharePoint site as Farm/Site collection administrator.
- Navigate to Site Settings >> Site Permissions
- Click on the “Permission Level” button from the ribbon.
- Select the permission level to remove and click on the “Delete Selected Permission Levels” link.
- Confirm the prompt to delete permission level.
Keep in mind that deleting a permission level will also delete all permissions of the users and groups granted that permission level. Now, let’s see SharePoint PowerShell to remove a permission level.
SharePoint: PowerShell script to delete a permission level
Use this PowerShell script, if you want to remove a permission level from your environment for any reason:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#Configuration parameters
$WebURL="https://portal.crescent.com/sites/Sales/"
$PermissionLevelName="Contribute without Delete"
#Get the Web
$Web = Get-SPWeb $WebURL
if($Web.RoleDefinitions[$PermissionLevelName] -ne $null)
{
$Web.RoleDefinitions.Delete($PermissionLevelName)
write-host "Permission level Deleted successfully!" -f Green
}
else
{
write-host "Permission level Not Found!" -f Red
}
Why would you advise not to delete the Contribute permission level?
Well, deleting default permission levels may end up with undesired results. If you delete a default permission level, it will be removed from all SharePoint groups that contain it within the site collection. This may cause users assigned to those groups to lose their permissions.
Could we Hide the permission level instead of delete it?
No! Hidden property is read-only.