A. Once you've enabled the recycle bin, you can undelete objects that were deleted after the recycle bin was enabled within the deleted object lifetime. You view the objects that are in the deleted and recycled states using the steps outlined in the previous FAQ.
To restore an object in the deleted state (isDeleted TRUE), simply pass the deleted object to the Restore-ADObject cmdlet. The easiest way to pass the object is to use the Get-ADObject cmdlet and pass the -IncludeDeletedObjects switch.
For example, if I know the displayName of an object is Dick Grayson, I would use the command below.
-eq "Dick Grayson"\} -IncludeDeletedObjects |
As you can see below, I actually use the Get-ADObject first just to view the object. I can see its Deleted attribute is True. I then pass the object to Restore-ADObject to undelete it. After that I viewed the object, and the Deleted attribute was blank, showing that it has been restored. In this example,e the object name was AFRBEnabled (After Recycle Bin Enabled).
Click to expand.
- Q: How can I delegate the right to unlock locked Active Directory (AD) user accounts?
- Q. Can I have Windows NT 4 BDC's in my Windows 2008 and Server 2008 R2 Active Directory domains?
- Active Directory Growth Tracker: A Script to Count Objects
- Q. How do I create the Systems Management container in Active Directory (AD)?
Check out hundreds more useful Q&As like this in John Savill's FAQ for Windows. Also, watch instructional videos made by John at ITTV.net.