Skip navigation
birds-2168271280.jpg

How to Migrate AD Users in the Same Forest With VBScript

In one of the earlier posts, I walked you through migrating AD users with the help of ADMT v3.2 (active directory migration tool) GUI between domains in the same forest. In this post, I’ll show you to migrate AD users with VBScript. 

Step-By-Step

1. Log in with domain admin account to one of the domain controllers in target domain where ADMT is installed.

2. Open notepad and paste the following script, save the file with .wsf extension in the same folder where templatescript.vbs is located.

 

<Job id=" MigratingUserAccountsBetweenDomainsInSameForest" >
<Script language="VBScript"  src="templatescript.vbs" />
<Script language="VBScript" >
   Option Explicit

   Dim objMigration
   Dim objUserMigration
 
   Set objMigration = CreateObject("ADMT.Migration" )
   Set objUserMigration = objMigration.CreateUserMigration
  
   objMigration.Intraforest = True
   objMigration.SourceDomain = "NetBIOS name or FQDN of source domain" 
   
   objMigration.SourceOu = "Canonical path of source OU" 
   objMigration.TargetDomain = "NetBIOS name or FQDN of source domain" 
   objMigration.TargetOu = "Canonical path of target OU" 
   
   objUserMigration.TranslateRoamingProfile = True
   objUserMigration.UpdateUserRights = True
   objUserMigration.FixGroupMembership = True
   objUserMigration.MigrateServiceAccounts = False
   'objUserMigration.MigrateGroups = False
   
         
   objUserMigration.Migrate admtData, array ("username1", “username2” )

   Set objUserMigration = Nothing
   Set objMigration = Nothing
</Script>
</job>

3. Open PowerShell and execute the following command

C:\windows\syswow64\csript.exe <scriptfilename.wsf> e.g. hello.wsf

4. Open Active Directory Users and Computers console in one of the domain controller in target domain. Verify the existence of newly migrated AD objects. 

Visit this link to read more about AD objects migration between domains in the same forest and migrate users, computers, and groups with ADMT GUI and command line. 

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish