Authored by: Support.com Tech Pro Team
How to Restore Deleted Objects in Active Directory
Active Directory Recycle Bin can be activated only where all domain controllers are running Windows Server 2016, Windows Server 2012 R2, Windows Server 2012 or Windows Server 2008 R2. Note: Enabling Active Directory Recycle Bin is irreversible.
Execute the following command to enable Active Directory Recycle Bin:
Enable-ADOptionalFeature –Identity ‘CN=Recycle Bin Feature,CN=Optional Features,
CN=Directory Service,CN=Windows NT,CN=Services,CN=Configuration,DC=www,DC=domain,
DC=com’ –Scope ForestOrConfigurationSet –Target ‘www.domain.com’
If you are using Windows Server 2016, Windows Server 2012 R2, or Windows Server 2012, you can use the Active Directory Administrative Center to enable the Recycle Bin.
The following table compares the cycle of a deleted object before and after enabling “Active Directory Recycle Binâ€:
BEFOREAFTERThe deleted object enters a “tombstone†stateThe deleted object enters a “logically deleted†state.Attribute “IsDeleted†is changed to the TRUE value.Attribute “IsDeleted†is changed to the TRUE value.Value of “WhenDeleted†is changed to “Time Changedâ€.A unique value is assigned to the Windows security descriptor.RDN is changed to an impossible value.The object is moved to the “Deleted Objects†container (CN=Deleted Objects).The object is moved to the “Deleted Objects†container (CN=Deleted Objects).The object is in the “tombstone†state for 180 days for Windows Server 2003 SP1/ 2008 and 60 days for Windows Server 2000/2003.The object remains in the “logically deleted†state for a period of 60 to 180 days in Windows Server 2008 R2.In tombstone states, most of the link-valued and non-linked value attributes are stripped off.As soon as an object enters a “logically deleted†state, all the object’s link-valued and non-linked value attributes are preserved by the system. The following attributes are not stripped off: Object- GUID, Object-SID, Object-Dist-Name, USNA process called “Garbage collector†removes the object from the database after the tombstone state expires.The object moves to the “Recycle†state. It remains here for another 60 to 180 days.The object is completely erased.Most of the attributes are erased.The object cannot be recovered.After the expiry of the recycled state, the garbage collection process starts, and it removes the object from the database.The object cannot be recovered.Here the administrator has to use an authoritative restoration to restore the deleted objects.The administrator can use PowerShell commands, LDP.exe, and AD administrative Center to restore deleted objects.
The tombstone lifetime is between 60 days for Windows Server 2000/2003 and 180 days for Windows Server 2003 SP1/ 2008 (in later versions this can be modified using the ADSIEdit tool).
Connect to the “Configuration†partition, navigate to “CN=Configuration,DC=www,DC=domain,DC=com†and expand it.
Right-click “CN=Directory Service†and access its properties. You can edit the “tombstoneLifetime†attribute in the “Properties†dialog box and change its value accordingly.
Reanimating deleted objects in Active Directory can be done using several methods. The following are some of the most commonly used native methods for restoring deleted objects in the Active Directory.
Test Case – In this scenario, a user (“testuser3â€) has been deleted from the Active Directory. You can use the following methods to restore a deleted object:
Method 1 – Using PowerShell commands
Perform the following steps:
Get-ADObject -ldapFilter:"(msDS-LastKnownRDN=*)" – IncludeDeletedObjects
Method 2 – Using LDP utility
Perform the following steps:
The object can be restored to the root domain but cannot be restored to its parent Organizational unit. After recovering the object, you have to move the object to its parent container manually.
Method 3 – Using Active Directory Administrative Center
Follow the below-given steps to recover deleted objects in Windows Server 2012 and Windows Server 2012 R2: