Link to home
Start Free TrialLog in
Avatar of towo2002
towo2002

asked on

How to move the user accounts from one OU to another OU by VBScript?

Dear all experts,

I would like to implement a VBScript program which is used to move some user / computer accounts from one OU to another, please kindly give me some advise about it.

Regards,
ASKER CERTIFIED SOLUTION
Avatar of RobSampson
RobSampson
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial


When I have that type of task I like to use dsmove - I just find it cleaner, I run csvde or dumps with vbscript before and after to check that all went well.

dsmove, dsquery, dsadd, etc all part of Windows 2003.


the script center at Microsoft website gives a very basic vbscript for move user:
http://www.microsoft.com/technet/scriptcenter/scripts/ad/users/manage/default.mspx
Set objOU = GetObject("LDAP://ou=sales,dc=na,dc=fabrikam,dc=com")

objOU.MoveHere _
    "LDAP://cn=BarrAdam,OU=hr,dc=na,dc=fabrikam,dc=com", vbNullString

Mark