AD.Account.CopyProperties
Top  Previous  Next


Copies specified properties from one user account to another

Use AD.Account.SetProperty to set single properties.

Category
Active Directory

Script section
All

AD.Account.CopyProperties
SrcAccountADPath, TrgtAccountADPath, PropertyList

SrcAccountADPath
Full AD path to source account  

TrgtAccountADPath

Full AD path to target account  
 
ListOfProperties
List of properties, Format: property name + "§" after each entry.  
Example: ADpropertyName1§ADpropertyName2§  
 
Some interesting "special" properties:  
·logonHours - logon hours  
·userWorkstations - log on to  
·userAccountControl - contains all "account options" flags except "user cannot change password" (which is the only flag that can not be set by using AD commands, workaround)  
 
The easiest way to find out correct property names is probably to use SetupExplorer, see How to display all existing properties for one account.  
 
Example
Copy properties from account "templateacc" in "users" container to accounts "acc1", "acc2" and "acc3" in "MyOU" OU

[Settings_Begin]
BatchSettings.Delimiter=TAB
BatchSettings.MarkerCol=2

SET ADDomainPath=dc=com/dc=acme/dc=D31
SET ADSourceAccount=%ADDomainPath%/cn=users/cn=templateacc
SET ADTargetContainer=%ADDomainPath%/ou=MyOU
[Settings_End]

[Machines_Begin]
\\MAIN04      NT PDC    Ok-AllDone
[Machines_End]

[Batch_Begin]
Data.Loop   
 AD.Account.CopyProperties %ADSourceAccount%, %ADTargetContainer%/cn=%col1%, LogonHours§userWorkstations§accountExpires§scriptPath§userAccountControl§   
Data.Endloop   
[Batch_End]

[Data_Begin]
acc1
acc2
acc3
[Data_End]