Firstly though the Active Directory Recycle Bin is not enabled by default and has certain domain and forest wide requirements before it can be enabled.
- Firstly, all domain controllers within the Active Directory forest must be running Windows Server 2008 R2.
- Secondly, the functional level of the Active Directory forest must be Windows Server 2008 R2.
For the ease of installation ,make sure that you are in Schema master or Domain naming master domain controller(Any or one among them will work)
Check this by using
C:\ netdom query fsmo
Errors
Enable-ADOptionalFeature : A referral was returned from the server
At line:1 char:25
+ Enable-ADOptionalFeature <<<< -Identity `CN=Recycle Bin Feature,CN=Optional Features,CN=Directory Service,CN=Windows
NT,CN=Services,CN=Configuration,DC=mydomain,DC=com' -Scope ForestOrConfigurationSet -Target `mydomain.com'
+ CategoryInfo : NotSpecified: (CN=Recycle Bin ...domain,DC=com:ADOptionalFeature) [Enable-ADOptionalFe
ature], ADException
+ FullyQualifiedErrorId : A referral was returned from the server,Microsoft.ActiveDirectory.Management.Commands.En
ableADOptionalFeature
Solution :
Just import the AD cmdlets into powershell first:
PS C:\Users\Sysadmin> import-module activedirectory
And then try
PS C:\Users\Sysadmin> Enable-ADOptionalFeature –Identity ‘CN=Recycle Bin Feature,CN=Optional Features,CN=Directory Service,CN=Windows NT,CN=Services,CN=Configuration,DC=mydomain,DC=com’ –Scope ForestOrConfigurationSet –Target ‘mydomain.com’