AD: Enabling and Using the Recycle Bin in 2008 R2 Active Directory

import-module activedirectory

Set-ADForestMode -Identity -ForestMode Windows2008R2Forest

Enable-ADOptionalFeature -Identity ‘CN=Recycle Bin Feature,CN=Optional Features,CN=Directory Service,CN=Windows NT,CN=Services,CN=Configuration,DC=mi,DC=com’ -Scope ForestOrConfigurationSet -Target ‘’

To retrieve a User where the login name is test excluded :

Get-ADObject -ldapFilter:”(sAMAccountName=test)” –IncludeDeletedObjects | Restore-ADObject

user name is ‘test’

To retrieve an Organizational Unit excluded named ” Directors:

Get-ADObject -ldapFilter:”(msDS-LastKnownRDN=Diretores)” –IncludeDeletedObjects | Restore-ADObject

To retrieve excluded Group:

Get-ADObject -ldapFilter:”(msDS-LastKnownRDN=Group)” –IncludeDeletedObjects | Restore-ADObject

To restore an excluded computer to perform:

Get-ADObject -ldapFilter:”(msDS-LastKnownRDN=Computer)” –IncludeDeletedObjects | Restore-ADObject

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: