Thursday, 21 February 2013

Active Directory Recycle Bin Feature in Windows Server 2008 R2


Active Directory Recycle Bin Feature in Windows Server 2008 R2

Prerequisites to enable the Active Directory Recycle Bin Feature:
Active Directory Forest Functional Level must be raised to Windows Server 2008 R2, you can do the same by Executing the below PowerShell Command.
                To Get the Forest Functional Level
                                Get-ADForest
                Raise the Functional Level to Windows Server2008 R2
                                Get-ADForest | Set-ADForestMode -ForestMode Windows2008R2Forest

1.       Enable the Active Directory Recycle Bin Feature by executing below Command.
To enable the Recycle Bin Feature in Windows Server 2008 R2 type the below PowerShell Command

Enable-ADOptionalFeature –Identity “Recycle Bin Feature” –Scope “ForestOrConfigurationSet” –Target “xyz.com”

2.       Get the List of Objects deleted from AD.
To get the list of deleted User Objects enter the below PowerShell Command

Get-ADObject -SearchBase "CN=Deleted Objects,DC=xyz,DC=com" -filter {Objectclass -eq "user"} -includeDeletedObject | Format-Table Displayname , ObjectClass , ObjectGUID

3.       Restore the Specific User Object deleted.
After you got the list of deleted user objects and you can restore a User Object test1by using below PowerShell Command.

Get-ADObject -Filter {DisplayName -eq "test1"} -includedeletedObjects | Restore-ADObject -Confirm:$False

4.       Check the Object Attributes correctly restored or not.

No comments:

Post a Comment