With the Active Directory Recycle Bin feature, we can recover a deleted Active Directory object. This feature is very important for system administrators who frequently use Active Directory, such as changes and deletions. Apart from this, a group or user that has been accidentally deleted can be taken back to their old location or to a different location specified. Also, when we bring back a user we deleted, their old group memberships are restored. When Active Directory Recycle Bin feature is activated, it cannot be disabled again.
Activating Active Directory Recycle Bin
Active Directory Recycle Bin does not come active by default. To start using it, we need to activate it. For this, we come to the area where our domain name is written on the “Active Directory Administrative Center” screen and click on the “Enable Recycle Bin” option.
After clicking the Enable Recycle Bin option, we see a screen asking if we want to activate the Recycle Bin feature. On the screen that appears, there is also the information that once Active Directory Recycle Bin is activated, it cannot be returned to a disabled state. By pressing the “OK” button, we activate the Recycle Bin feature.
After completing our operations, when we refresh the “Active Directory Administrative Center” screen, you can see that the “Enable Recycle Bin” option at the bottom right has become inactive.
PowerShell Command
We can check whether “Active Directory Recycle Bin” is active or not from PowerShell. You can use the command “Get-ADOptionalFeature -filter *” to control it from PowerShell.
PS C:\Users\Administrator> Get-ADOptionalFeature -filter *
Active Directory Recycle Bin Restore
After activating the Active Directory Recycle Bin feature, we will delete a user in our structure and bring back that user. We delete the user named “asaf” under the “IT Users” OU.
You can see that the user has been deleted on the screen below.
Deleted user objects are kept in “Deleted Objects” in “Active Directory Administrative Center“. By right-clicking on the user or under the “Tasks” area at the top right, “Restore” and “Restore To” options appear.
To explain the options here, “Restore” brings the object back to the location before it was deleted. “Restore To“, on the other hand, allows us to restore the object to a location we want, other than the original location it was deleted.
Here, we want the object to be restored by selecting the “Restore” option.
After performing the restore process, you will see that it comes back under the “IT Users” OU, as in the picture below.