1. 准备导入文件(csv格式)

    格式为:  语言,全名,用户名,密码

2.  准备批处理文件


for /f "tokens=1,2,3,4 delims=," %a in (book1.csv) do dsadd user "CN=%c,ou=%a,ou=Translators,ou=View users,ou=View Group,dc=enjoytr,dc=com" -samid %c -upn %c@enjoytr.com -pwd %d -pwdneverexpires yes -display %c 

 

@ECHO Wscript.Sleep(5000) > sleep.vbs

@START /w wscript.exe sleep.vbs

@DEL /Q sleep.vbs

 

 

for /f "tokens=1,2,3,4 delims=," %a in (book1.csv) do dsquery user "CN=%c,ou=%a,ou=Translators,ou=View users,ou=View Group,dc=enjoytr,dc=com" |dsmod user -profile "\\transdeskdc\userprofile\%a\$username$"  -hmdrv "Z:" -hmdir "\\transdeskdc\translatorWork\%a\$username$"

 

@ECHO Wscript.Sleep(5000) > sleep.vbs

@START /w wscript.exe sleep.vbs

@DEL /Q sleep.vbs

 

 

for /f "tokens=1,2,3,4 delims=," %a in (book1.csv) do mkdir D:\userprofile\%a\%c

 

for /f "tokens=1,2,3,4 delims=," %a in (book1.csv) do cacls D:\userprofile\%a\%c /t /e /c /g %c:f

 

 

for /f "tokens=1,2,3,4 delims=," %a in (book1.csv) do mkdir D:\Work\%a\%c

 

 

for /f "tokens=1,2,3,4 delims=," %a in (book1.csv) do cacls D:\Work\%a\%c /t /e /c /g %c:f

 

 

 

for /f "tokens=1,2,3,4 delims=," %a in (book1.csv) do dsquery user "CN=%c,ou=%a,ou=Translators,ou=View users,ou=View Group,dc=enjoytr,dc=com" |dsmod user -profile "\\trans