Link to home
Start Free TrialLog in
Avatar of rwhittle
rwhittle

asked on

Moving user to an OU from the command line

Hi,
I am using windows 2000 server and I will be creating a lot of users and after creating the users I will have to put them in different OU's.  

How can I use the command line of windows 2000 to move a user from the default users group to a particular OU?

If there is a file to do this, where can I get a download of that particular file?

I use the net user command to create user (it is over 7000 users and they have about 7 different OU's) , so I know if I created them from active directory I could press the right button choose move then select the OU, but I am not using the AD method.  I hope you understand and can help me.

Thanks in advance.
ASKER CERTIFIED SOLUTION
Avatar of scampgb
scampgb
Flag of United Kingdom of Great Britain and Northern Ireland 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
Avatar of Pete Long
you allrady have the tools, syntax is here

Moving a user account to a different container within the same domain
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/scriptcenter/scrguide/sas_usr_aznz.asp

Moving a user account to a different container within the same domain

Listing 7.18 contains a script that moves a user account from one OU to another OU within the same domain. To carry out this task, the script performs the following steps:

1.
 Bind to the target OU by using the GetObject function and the LDAP provider.
 
2.
 Use the MoveHere method of IADsContainer to move the user account from the HR OU to the Sales OU.
 


 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", "cn=barradam"

 
Avatar of rwhittle
rwhittle

ASKER

Thanks fo your response

but how can i get a copy of dsmove.exe or movehere.exe?
>> movehere.exe?

you allready have it its pers of the server WMI interface

substitute your details for the example above bang it all in a notepad file

save it as move.vbs and then run it
You should find dsmove in %SystemRoot%\System32
DSMove is a part of directory services command line tools...  You don't have to script it's use... You can also use from a command line...

Here's further explanation:

http://www.microsoft.com/windowsxp/home/using/productdoc/en/default.asp?url=/windowsxp/home/using/productdoc/en/ds_command_line_tools.asp