Enabling the AD Recycle Bin and Recovering Objects

This is an easy process. Recovering deleted AD objects using the old methods was not. By default, even in new domains, the AD Recycle Bin is not enabled.

Before doing this, the object lifecycle should be understood. Once the AD Recycle Bin is enabled, when an object is deleted it is considered to be logically deleted, which is when the object’s attributes are preserved. It remains in this condition until the “Deleted Object Lifetime” period is met. This value is called the msDS-deletedObjectLifetime attribute, which by default is null, and thus is controlled by the “tombstone lifetime” attribute. At the end of this time point, most of the attributes are stripped away and the object is now in the “Recycled Object Lifetime” period. At this point an object can not be recovered using the AD Recycle Bin and the the object is similar to “tombstoned” objects, the lifecycle of which can be controlled by changing the tombstone lifetime attributes. Default for this time period is 180 days, but older domains may be different. Following this time period, the object is permanently and physically deleted.

Enabling the AD Recycle Bin

PowerShell example from the MS website:

Enable-ADOptionalFeature -Identity 'CN=Recycle Bin Feature,CN=Optional Features,CN=Directory Service,CN=Windows NT,CN=Services,CN=Configuration,DC=contoso,DC=com' -Scope ForestOrConfigurationSet -Target 'contoso.com'

Or for the GUI:

Server Manager -> Tools -> Active Directory Administrative Center (ADAC) -> Manage -> Add Navigation Nodes -> <Domain Name>(local)

In the Tasks pane, click “Enable Recycle Bin”

Recovering Deleted Objects

Server Manager -> Tools -> Active Directory Administrative Center (ADAC) -> Manage -> Add Navigation Nodes -> <Domain Name>(local)-> Deleted Objects

Chose the object to restore and click “Restore” in the Tasks pane. For recovering multiple objects, such as recovering an OU, a search of the web might be necessary to script the recovery.

Note about msDS-deletedObjectLifetime and tombstone lifetime attributes

These can be found and changed using ADSI Edit and PowerShell.

It is worth taking a look at these especially if the existing domain began prior to Server 2003 since the default tombstone dates were typically only 60 days in length.