Code:
for /f "Tokens=1,2,3,4,5,6,7,8 Delims=," %%a in (newusers.csv) do
(dsadd user "cn=%%a,ou=%%b,ou=%%g,dc=evolvedit,dc=com" -samid %%a -upn %%a@yourdomain.com -fn %%d -ln %%e -display "%%d %%e" -hmdir "%%f%%a\My Documents" -hmdrv h: -pwd "ChangeMe" -canchpwd yes -pwdneverexpires no -memberof "cn=%%g,ou=%%g,dc=yourdomain,dc=com"
md "D:\User Home Folders\%%g\%%b\%%a\My Documents"
cacls "D:\User Home Folders\%%g\%%b\%%a" /T /G "%%a":F /e
cacls "D:\User Home Folders\%%g\%%b\%%a" /T /G Administrators:F /e
cacls "D:\User Home Folders\%%g\%%b\%%a" /T /E /R Everyone
cacls "D:\User Home Folders\%%g\%%b\%%a" /T /E /R Users
echo added user %%a >> userlog.txt
)
I use something like this. This script reads the vaiables from a CSV file (each user on a separate line)
DSADD adds the user account to active directory, sets the password, and places the user account in the correct OU
You can specify other options using DSADD see this artical.
http://technet2.microsoft.com/window....mspx?mfr=true
The home folder is created below a shared home folder for staff and students respectively so you don’t have to worry about sharing or setting share permissions.
CACLS sets the ACL information on the home folder.