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


import-module activedirectory

Set-ADForestMode -Identity mcsesolution.com -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 ‘mi.com’

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

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: