1,批量新建用户,在当前目录新建一个testxin.csv的文件,然后运行如下命令
for /f "tokens=1,2,3,4,5 delims=," %a in (testxin.csv) do dsadd user "cn=%c,ou=90,ou=life,ou=90life,dc=life90,dc=com" -samid %d -upn %[email protected] -ln %a -fn %b -pwd %e -disabled no -memberof "cn=lifeadmins,ou=组,ou=90life,dc=life,dc=com"
用 for /f 来提取csv里面的内容 token选取 delims来切片
用dsadd user 来新建用户
用 -memberof 参数来添加到组
2,csvde来导出域用户备份
csvde -d "ou=90life,DC=lif90,DC=com" -r "(&(objectcategory=person)(objectClass=user))" -l "name,sAMAccountName,description,title,department,telephoneNumber,mail,userAccountControl" -f C:\Users\Administrator\Desktop\Users-List.csv -s life90.com -u