Requirement: In our organisation, several employees have frequent transfers to different zones, which are different domains within a single forest. Need to transfer users from one domain to another domain using some free of cost solution.

My Understanding:

I know that there are several tools available in the market like Quest, etc. which is dedicated for this. Then, we have Microsoft's free ADMT for this as well. I am looking to automate the process in our case using C#, or else, using powershell script (I'm not very much comfortable).


I have searched on the web to invoke something using C#, but, the result was almost in vain. Then I switched to powershell variant, where I found some posts like this on GitHubGist, but, the requirements and the warnings mentioned there makes me feel uncomfortable.

Moreover, since we are having an Exchange setup, so the requirement is to migrate all the attributes set in the user account in the source-domain. So, scripts like the ones mentioned above clearly say that they have left some of the additional settings.

What I want is to automate our flow of user-migration, but using our own script/code which we will thoroughly test and deploy.


I tried using Move-ADObject in my UAT setup, where there is no firewall challenge or limitation, but, still it gives an error stating "A referral was returned from the server". I used all kinds of permission, but, the error still remains the same.

I used below cmdlet what is stated in the Microsoft's TechNet article:

Moves an object with DistinguishedName 'CN=Peter Bankov,OU=Accounting,DC=Fabrikam,DC=com' to a different domain.

// Moves an object with 
// DistinguishedName 'CN=Peter Bankov,OU=Accounting,DC=Fabrikam,DC=com' 
// to a different domain.

Move-ADObject -Identity "CN=Peter Bankov,OU=Accounting,DC=Fabrikam,DC=com" 
-TargetPath "OU=Accounting,DC=Europe,DC=Fabrikam,DC=com" 
-TargetServer "server01.europe.fabrikam.com"

UAT architecture is having the forest domain with several child servers which are having transitive trusts. Trust of all child servers is with the root server.


I'm looking for an effective solution which helps to migrate user account with same set of attributes set in the previous-domain. Thanks for your time.

NOTE: Please bear with me; this may look like a programming question, but, is more inclined to knowing the process of how and which options to explore. I have recently begun working on Active Directory Services.

  • You might wanna check this out: social.technet.microsoft.com/wiki/contents/articles/…
    – Makorus
    Apr 10, 2018 at 8:27
  • 1
    @Makorus - Thanks, but, I've already checked these links. I wanted to do the same using some sort of script. Right now we're using the GUI of ADMT to migrate users on a case to case basis. I'll write the answer for this question, if I find the solution using codes/scripts. Thanks again for your time. Apr 10, 2018 at 16:52

1 Answer 1


Having just tested it, I can vouch for the fact that Move-ADObject can move objects between domains. The syntax you need is as follows:

Move-ADObject -Identity "CN=Test Move,OU=SourceOU,DC=Domain,DC=suffix" -TargetPath "OU=Test,DC=child,DC=Domain,DC=suffix" -TargetServer "Target-Domain-RID-master" -Server "Local-Domain-RID-master"

This moved a user from the forest root to a child domain.

Not the answer you're looking for? Browse other questions tagged or ask your own question.