Active Directory Recycle Bin

Active Directory Recycle Bin is a new feature in windows 2008 R2 it is not an option that you can turn on or of.

Yes it is a hidden feature and you can only turn it on. What do you need well only a windows 2008 R2 DC

By default, Active Directory Recycle Bin in Windows Server 2008 R2 is disabled. To enable it, you must first raise the forest functional level of your AD DS or AD LDS environment to Windows Server 2008 R2, which in turn requires all forest domain controllers or all servers that host instances of AD LDS configuration sets to be running Windows Server 2008 R2. After you set the forest functional level of your environment to Windows Server 2008 R2, you can use the instructions in this guide to enable Active Directory Recycle Bin.

The restore can only be done with powershell there is no supported tool from microsoft but there are nice gui tools.

http://powergui.org/shares/powergui/sbin/docs/Advanced_Reporting_PowerPack/Advanced_Reporting_PowerPack.html

http://www.overall.ca/index.php?option=com_content&view=article&id=40:adrecyclebin&catid=15:adrecyclebinexe&Itemid=64

How does It work.

You can enable it if your forest is on windows 2008 R2 <> check it in Active directory domains and trusts <> right click on domain<> raise domain functional level.

Active Directory Recycle Bin I started the Powershell and get this. Active Directory Recycle Bin

Oh ok I never used the powershell on this server so I have to import the modules

Active Directory Recycle Bin  Active Directory Recycle Bin

Now I am ready to go , mm what is this error

Active Directory Recycle Bin

security ! ok we can fix this so check our powershell policy : Get-ExecutionPolicy

Active Directory Recycle Bin Restricted easy thing change one letter G=S

Set-ExecutionPolicy RemoteSigned

Active Directory Recycle Bin   Now we have set the policy and get a list off commands

Get-help set-AD*

this shows a list of all set-ad starting commands.

Active Directory Recycle Bin

Active Directory Recycle Bin

We have already checked that the domain is in 2008R2 mode but you can set this with powershell.

set-ADForestMode -Identity mvp.local -ForestMode Windows2008R2Forest.

To enable the AD recycle Bin we use Powershell, you can do this by hand in the CN=Partitions but this is the best way.

Active Directory Recycle Bin No Ad recycle bin key.

We run the enable option. you can get help on this get-help Enable-ADOptionalFeature

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

Active Directory Recycle Bin

Active Directory Recycle Bin Now there is a key CN=Recycle Bin Feature

To verify that Active Directory Recycle Bin is enabled, navigate to the CN=Partitions container. In the details pane, locate the msDS-EnabledFeature attribute, and confirm that its value is set to CN=Recycle Bin Feature,CN=Optional Features,CN=Directory Service,CN=Windows NT,CN=Services,CN=Configuration, DC=mydomain,DC=com, where mydomain and com represent the appropriate forest root domain name of your AD DS environment

Active Directory Recycle Bin

We do a list of deleted items check on deleted=True

Active Directory Recycle Bin I used a user that is called “Deleted”

 

Active Directory Recycle Bin   Active Directory Recycle Bin

Get-ADObject -Filter {displayName -eq "delete"} –IncludeDeletedObjects

Active Directory Recycle Bin   Active Directory Recycle Bin

Get-ADObject -Filter {displayName -eq "delete"} -IncludeDeletedObjects | Restore-ADObject

Active Directory Recycle Bin

So now you can delete and restore AD items but better would be if there where gui tools.

There are no Gui Tools from microsoft at this time. but there are some great community tools . I like the tool from Overall solutions, but there is also a powergui tool

 

AD Recycle bin AD Recycle bin

image

 

Have fun with it don’t tell your user or IT manager this that you can restore Items with a click or script in 10 min time. Else you get more work on recovering deleted items. Even the helpdesk can do this. IMHO this is a must have option just like AGPM Or my old post

Posted September 18, 2009 by Robert Smit in Active Directory Recycle Bin, Windows 2008 R2

Tagged with ,

  • Tag