Delete custom permission level using PowerShell
cls
$spSite = Get-SPSite "http://sedwdevrtm:22222/sites/a123
"
$spWeb = $spSite | Get-SPWeb
# check to see if the permission
your are going to delete is not existing..
if($spWeb.RoleDefinitions["MyCustomPermission"] -ne $null)
{
$spRoleDefinition = New-Object Microsoft.SharePoint.SPRoleDefinition
$spRoleDefinition.Name = "MyCustomPermission"
$spWeb.RoleDefinitions.Delete( $spRoleDefinition.Name)
Write-Host $spRoleDefinition.Name " Deleted
successfully"
}
else
{
Write-Host "Custom
Permission doesn't exist"
}
$spWeb.Dispose()
$spSite.Dispose()
No comments:
Post a Comment