In Active Directory, you have the ability to enable the Recycle bin option, not only from the Active Directory Admin Center but also from PowerShell.

Let’s say that you have just setup a new domain or you have an existing one and when you use PowerShell to enable the Recycle Bin or the Admin Center you are presented with an error:

A referral was returned from the server.

and here is the error from PowerShell:

Powershell:- enable active directory recycle bin gives error

The PowerShell command in question used is as follows:

Enable-ADOptionalFeature -Identity 'Recycle Bin Feature' -Scope ForestOrConfigurationSet -Target tlab.local
Powershell:- enable active directory recycle bin gives error

At the end you see I have tlab.local at the end of the command, replace this with your internal domain name.

Solution:

To fix the above error, you need to ensure that your domain naming master and schema master roles are on the same domain controller, to move the role you can run the following command:

Move-ADDirectoryServerOperationMasterRole -Identity "Server02" -OperationMasterRole SchemaMaster
Powershell:- enable active directory recycle bin gives error

Once the above command has completed, you can run the command below to check if replication has taken place and that the Schema Master role is showing on the server you selected to move it it:

netdom query fsmo

Once replication is complete, you can attempt the first PowerShell command or use the GUI to enable the Recycle Bin option.

Hope it helps.

    wpChatIcon

    Discover more from Everything-PowerShell

    Subscribe now to keep reading and get access to the full archive.

    Continue reading