Important Note:This acction is irreversible, so when you activate the Active Directory Recycle Bin Feature you will not be able to disable this feature!
First open Active Directory Module for Windows PowerShell (You can find it on your DC Administrative Tools).
Then type this command:
Enable-ADOptionalFeature –Identity “CN=Recycle Bin Feature,CN=Optional Features,CN=Directory Service,CN=Windows NT,CN=Services,CN=Configuration, DC=domain,DC=com” –Scope ForestOrConfigurationSet –Target “domain.com”
You need to change “DC=domain,DC=com” and “-Target “domain.com” to your domain information.
If youreceive this error:
You just need to run the Active Directory Module for Windows PowerShell with your Domain Admin and with “Run As Administrator”.
After do this here is the result:
Now the Active Directory Recycle Bin is enabled,and if you need to restore an ADObject you just need to list the recycle bin objects:
Get-ADObject -SearchBase “CN=Deleted Objects,DC=domain,DC=com” -ldapFilter “(objectClass=*)” -includeDeletedObjects | FT ObjectGUID,Name -A
Then you can recover the Object using this command:
Restore-ADObject -Identity dd83eec4-f136-4aed-b1e1-437f7fed4f92
Hope you enjoy