The following error may appear during Active Directory Recycle Bin enable process: “Enable-ADOptionalFeature : A referral was returned from the server”.
a. Locate the server/s that hosting “Domain Naming Master” and the “Schema Master” FSMO (Flexible Single Master Operations) Roles.
b. In case that the each role is locate in a separate Active Directory domain, transfer the Domain Naming Master” and the “Schema Master” FSMO to a single server.
c. Force Active Directory replication.
d. Retry to enable the Active Directory Recycle Bin
For further information please review: