ADMT: OU syntax in Option File or vbScript

Published on Tuesday, May 25, 2010 in ,

For my current project I wanted to ease some of the ADMT tasks by using an option file and as such avoid the GUI and its repeatedly point and clicks. So I ended up figuring out how to translate the checkboxes from the GUI to the option file equivalent. At first I thought figuring out what the exact options were would be hard. Not at all! A nice sample is given in the ADMT guide and every (I mean every) possible setting/value is explained in a help file located somewhere in the c:\windows\admt installation folder.

The ones which weren’t explained was the syntax for the “source ou” and “target ou”. One could think, how hard can that be?

  • ou=users,ou=department,ou=resources,dc=source,dc=com
  • ou=users,ou=department,ou=resources
  • LDAP://source.com/ou=users,ou=department,ou=resources,dc=source,dc=com

Example error:

The migration log was stored in the database. The migration log can be retrieved from the database by using the 'ADMT TASK' command. Unable to migrate users. Unable to bind to container 'LDAP://targetdomain/OU=users,OU=_Migration,DC=target,DC=com'.  Unable to get distinguished name for 'target.com/LDAP://target.com/OU=users,OU=_Migration,DC=target,DC=com'.  : The parameter is incorrect. (0x80070057)

And a screenshot:


All my options were wrong, so I started google and stumbled upon this: GNT Forums: ADMT command line or vbscript syntax in OU

The required syntax is the following:

  • drop the domain part from the DN
  • provide the OU’s up to down in the domain tree
  • separate OU’s by using “/” (not ou=,)


  • “resources/department/users”

Now that wasn’t obvious to me…

Once the option file is completed, it can be used with the admt commandline tool: “admt user /f:users_to_migrate.txt /o:optionfile.txt”. This is merely and example, a lot of variations on this matter exist.

Related Posts

1 Response to ADMT: OU syntax in Option File or vbScript

15 August, 2012 02:20

In case someone needs to do this and doesn't wanna take the time to roll their own. I whipped this up for this little task.

# Target OU must be in slash format and not have any of the DC portion.
$targetOU -match "^(.*?),DC.*$"

$s = $matches[1].ToLower()

$s = $s.replace(',cn=','/').replace('cn=','').replace(',ou=','/').replace('ou=','')

# Now split by / to make tokens
$tokens = $s.split('/')


$slashOU = $null

# Put back together again..
foreach ($token in $tokens){
$slashOU += ($token + "/")

# Kill trailing slash
$slashOU = $slashOU.Substring(0, $slashOU.length - 1)

Add Your Comment