Deleting Permissions

This chapter describes how to delete userdefined Permission-objects.


Hint: For compatibility reasons, the cmdlets for Task-objects (like Remove-EmdbTask) are still available. However, during an interactive PowerShell-session you will get a warning to use the new Remove-EmdbPermission cmdlet instead.


Examples:


Hint: The execution of these examples requires a connected PowerShell drive.


In order to delete the previously created Permission "Reboot", the following command can be used. Please be aware that userdefined Permissions have the "Custom." prefix in their names:


Remove-EmdbPermission "Custom.Reboot"


As an alternative, it is possible to delete the previously created Permission-objects using the Delete()-method of the corresponding object.  


$MyPermissoin = Get-EmdbPermission "Custom.Reboot"

$MyPermissoin.Delete()


It it also possible to use the Remove-Item Cmdlet. If you are using that option, you have to take into account, that Permission-objects are a member of the container rootCatalog and are not located in the usually used container rootDSE:


Remove-Item "emdb:\rootCatalog\Custom.Reboot"


Note: It's not possible to delete Standard-Permissions, that is rights that are part of a DSM 2014.1 base installation. Only userdefined Permissions can be deleted.


Note: Note that Permission-objects are not part of the context rootDSE and therefore they can be referenced without a full qualified path resp. an absolute path.


Starting with PSX 3.1 there was a new option implemented when deleting Permission objects. When specifying the SingleItemExpected-switch it is expected, that none or exactly one object is affected. If the command would delete more than one object, an error is raised that can be caught and handled in scripts.