Daniel Ramawidjaja Blog

June 15, 2009

Restore Deleted Objects with Active Directory Recycle Bin

Filed under: Active Directory,Windows Server 2008 R2 — Daniel Ramawidjaja @ 10:51 am
Tags: ,

Active Directory Recycle Bin is a new feature on Windows Server 2008 R2, so this tip applies only to Windows Server 2008 R2.

Active Directory Recycle Bin helps minimize directory service downtime by enhancing your ability to preserve and restore accidentally deleted Active Directory objects without restoring Active Directory data from backups, restarting AD DS, or rebooting domain controllers. When you enable Active Directory Recycle Bin, all link-valued and non-link-valued attributes of the deleted Active Directory objects are preserved and the objects are restored in their entirety to the same consistent logical state that they were in immediately before deletion. For example, restored user accounts automatically regain all group memberships and corresponding access rights that they had immediately before deletion, within and across domains.

You can restore deleted Active Directory objects  by using PowerShell command. Here the snapshots:

Import Active Directory module

> Import-Module ActiveDirectory

Get information about Recycle Bin feature

> Get-ADOptionalFeature -Filter { name -like “Recycle*” }

Enable Recycle Bin feature

> Enable-ADOptionalFeature “Recycle Bin Feature” -Scope ForestOrConfigurationSet -Target MiniSoft.com

Active Directory Recycle Bin

For example here, I deleted the Finance OU

Example: Delete Finance OU

List the deleted objects

> Get-ADObject -SearchScope subtree -SearchBase “cn=Deleted Objects,dc=minisoft,dc=com” -includeDeletedObjects -filter { name -notlike “Deleted*” }

List the Deleted Active Directory Objects

Restore the deleted objects

> Get-ADObject -SearchScope subtree -SearchBase “cn=Deleted Objects,dc=minisoft,dc=com” -IncludeDeletedObjects -filter { name -notlike “Deleted*” } | Restore-ADObject

Restore Objects

Verify that the Active Directory objects has been restored

Verify the Restored Objects

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

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

Blog at WordPress.com.

%d bloggers like this: