Prerequisites:
  • Admin access to the Active Directory
  • If copying user values across domains/forests, ensure your signed-in account has the rights at least to READ values from source domain and to WRITE values in the target domain
  • the target domain must already contain schema extensions for the attributes that are being copied (IOW, you have manually extended the AD schema or you have run Microsoft Exchange setup.com /schemaprep on the domain


Example 1
For this example, you only need the regular command line.

cscript.exe .\copymsolattributes.vbs dc1.mydomain.local useralias1 dcX.myotherdomain.loc useralias2 AllowAliasMismatch

This script copies attributes from useralias1 in the mydomain.local domain to useralias2 in the myotherdomain.loc domain. Note that because useralias1 is different from useralias2, you must supply the AllowAliasMismatch parameter.

Example 2
For this example, you only need the regular command line.

cscript.exe .\copymsolattributes.vbs dc1.mydomainlocal useraliasX dcX.myotherdomain.loc useraliasX

This script copies attributes from useraliasX to the same-named user in myotherdomain.loc domain. Because user aliases (SAMAccountNames) are the same, AllowAliasMismatch parameter is not required.

Example 3

For this example, you will need the PowerShell command line and a CSV file containing user aliases and domain controllers.

$csv = import-csv –path .\users.csv

$csv | %{ cscript.exe .\copymsolattributes.vbs $_.SourceDomainController $_.SourceUserAlias $_.TargetDomainController $_.TargetUserAlias $_.AllowAliasMismatch}

This example uses PowerShell and a CSV file to perform a bulk alias copy operation. Here’s a sample CSV file that can be used in conjunction with the script above:

SourceDomainController,SourceUserAlias,TargetDomainController,TargetUserAlias,AllowAliasMismatch

mydc1.domain1.local,user1,dc1.domain2.loc,user1,

mydc1.domain1.local,user2,dc1.domain2.loc,MyUser2,AllowAliasMismatch

Last edited Apr 13, 2012 at 1:08 PM by ilyal, version 2

Comments

No comments yet.