There are a couple of ways to restore deleted objects from Active Directory Recycle Bin. The default age that a deleted object stays in the AD Recycle Bin is 180 days. Therefore, you have 6 months to restore the object from the recycle bin before it is gone forever. Unless you are a glutton for punishment, I see no reason to use LDP.EXE to restore AD objects from the Active Directory Recycle Bin. Use the Powershell command below. The Active Directory Recycle Bin is a feature which was first introduced in the Windows Server 2008 R2 functional level. It is a long awaited option that will come in very handy.
Using Powershell
Get-ADObject -SearchBase “CN=Deleted Objects,DC=mydomain,DC=mydomain,DC=com” -ldapFilter “(cn=*comp123*)” -includeDeletedObjects | Restore-ADObject
Using LDP.EXE
- Open Ldp.exe from an elevated command prompt. Open a command prompt (Cmd.exe) as an administrator. To open a command prompt as an administrator, click Start. In Start Search, type Command Prompt. At the top of the Start menu, right-click Command Prompt, and then click Run as administrator. If the User Account Control dialog box appears, enter the appropriate credentials (if requested), confirm that the action it displays is what you want, and then click Continue.
- The default is to view 1,000 child items. if you have more than 1,000 deleted objects, then you must increase this buffer size in order to view ALL deleted objects. Select Options, click General. Change Max Children to a large number like 9,999 or more depending on how many deleted objects you want to view. Select OK.
- To connect and bind to the server that hosts the forest root domain of your AD DS environment, under Connections, click Connect, and then click Bind. You should now be connected to your Active Directory database.
- In the Controls dialog box, expand the Load Predefined pull-down menu, click Return deleted objects, and then click OK.
- In Edit Entry Attribute, type distinguishedName.
- In Values, type the original distinguished name (also known as DN) of this Active Directory object.
- Under Operation, click Replace.
- Make sure that the Extended check box is selected, click Enter, and then click Run.
|