Script to move user accounts and append to Groups within an OU

E

Elfyn

I'm currently in the process of trying to simplify our administration
burden using scripting. I plan to redesign our AD structure to have
various OU's for each department, and then within these OU's will be
the users of the department and also the groups for that deparment e.g.
Distribution groups, Security Groups. And also on the OU's will be a
department policy to setup default file locations in Office
applications etc

Has anyone any information for me on how to script this, or any samples
i.e. i'd like to move an user from one OU to another, and then when the
user is moved to a new OU all the groups contained in the new OU to be
added to the user account. And the groups that the user was a member of
from the old OU to be disconnected from the user account.

Thanks in advance for any replies.

Elfyn
 
R

rwh

I have done this in the past using dsmove to move the accounts from 1
OU to another.
You can use parsing to fill in the variables.
********************************************************************************
for /f "Tokens=1" %%i in (c:\users.txt) do call :parse %%i
goto end
:parse
********************************************************************************
dsmove example:
dsmove.exe "CN=%1,ou=faculty,DC=mydomain,DC=domain,DC=edu" -newparent
OU=Staff,DC=mydomain,dc=domain,dc=edu

I then would use a simple "Net Group" to modify the group membership
net group example:
NET GROUP Staff %1 /ADD /DOMAIN

This is a start for you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top