Hi I am using UiPath’s UiPath.ActiveDirectoryDomainServices.Activities and using Delete User activity but unfortunatly I am getting below error when i try to delete user account:
Unable to delete User: XXXXX. Reason: An error has occurred: The directory service can perform the requested operation only on a leaf object.
Hi @pratik.gupta,
I can only guess, but you are probably trying to remove object which is not user (group or other object type). Or this object is protected from removal. You can check it by enabling “advanced view” mode in Active Directory Users and Computers and going into properties of this object. On Object tab there will be marked something like “Protect object from accidental deletion”.
All seems fine so far. The only thing which is left is to check if you have full permission for this node to remove anything. Is manual deletion from ADUC console working for you without any prompt for full admin password or something like that?
I tried manually deleting the user from ADUC tool and there was a pop up which says “Object XXX contains other objects. Are you sure you want to delete all of the object it contains?”
When I click ok on this popup box the user gets deleted successfully.
But in case of uipath activity there is no such flag present where we can tell the activity to proceed with delete even if there is subtree in it.
This “Object XXX contains other objects. Are you sure you want to delete all of the object it contains?” means that it’s not user but container so you can’t treat this object with Delete User activity. Please make sure if it’s user type of object and not for example group of users.