Enable Active Directory Recycle Bin in Windows Server 2008 R2 and How to Restore Single Deleted Object using PowerShell.


Before we begin

The account with which we are going to perform this steps must be a member of Domain Admins and Enterprise Admins Group.

The Forest Functional level should be Windows Server 2008 R2.

Best Practices

It is always recommended to have a proper system state backup. To know how to perform system state backup in 2008 machines please click here. Recycle bin is just an option in Windows Server 2008 R2. Once enabling this feature it cannot be reversed under any circumstances. So plan accordingly.

Scenario

One Domain Controller by the name as follows.

DC name : DC1.MSEXCHANGETEAM.IN

Forest Functional Level : Windows Server 2008 R2.

By Default Recycle bin is not enabled. We have to enable them manually.

Below is the step by step scenario on how to restore single AdOject which was deleted.

image

Figure 1.1 : Object which will be deleted.

Before deleting the object we have to enable Recycle Bin.

image

Figure 2.1 : Importing Active Directory Module.

In figure 2.1 we import Active Directory Module to install Ad Optional Features.

image

Figure 2.2 : Enable AdOptionalFeature.

image

Enable-ADOptionalFeature –Identity ‘CN=Recycle Bin Feature,CN=Optional Features,CN=Directory Service,CN=Windows NT,CN=Services,CN=Configuration,DC=MSEXCHANGETEAM,DC=IN’ –Scope ForestOrConfigurationSet –Target ‘MSEXCHANGETEAM.IN’

Figure 2.3 : Command for reference.

image

Figure 3.1 : Object marked for deletion.

image

Get-AdObject -Filter {displayname -eq “Sunder”} -IncludeDeletedObjects | Restore-ADObject

Figure 4.1 : Command to restore AdObject

image

Figure 5.1 : Object Restored Successfully.

Thanks to Microsoft for bringing such a wonderful feature for which Windows Administrators waited for almost a decade.

In the next part series we will walk you through the steps using LDP.exe tool.

Courtesy Microsoft.

Disclaimer : The above scenario is thoroughly tested on lab. Please ensure that MSEXCHANGETEAM.IN would not be held responsible for any data loss or outage by following the above steps. Please read the documents carefully before proceeding further.

Happy Learning

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: