Enable Active Directory Recycle Bin Using PowerShell

In this blog post, I will show you how to enable Active Directory Recycle Bin using PowerShell.

About Active Directory Recycle Bin

The AD Recycle Bin allows us to restore AD objects like users, groups and computer objects after they have been deleted.

By default, deleted objects are retained in the recycle bin for 180 days before they are deleted forever.

When an object is restored, all attributes and group memberships are restored as well.

It is important to note that once you enable the feature, you cannot turn it off.

Code

Below is the PowerShell code to enable the Recycle Bin.

Make sure you change the domain name and domain controller.

Enable-ADOptionalFeature -Identity 'Recycle Bin Feature' `
-Scope ForestOrConfigurationSet -Target 'Domain.LOCAL' -Server DCSERVER01 `
-Confirm:$false

To use the Active Directory console to enable the recycle bin, visit the following post.

Leave a Reply

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