------使用CSVDE----------
DN,ObjectClass,SAMAccountName,userPrincipalName,displayName,userAccountcontrol
"cn=Alice,ou=HR,dc=contoso,dc=com",user,Alice,[email protected],hujintao,512
"cn=Bob,ou=HR,dc=contoso,dc=com",user,Alice,[email protected],Alice,512

执行命令:CSVDE -i -f 111.txt


------使用LDIFDE------------------
DN:cn=Alice, ou=Sales,dc=contoso,dc=com
changetype:add
objectClass:user
SAMAccountName:Alice
userPrincipalName:[email protected]
displayName:Alice
userAccountControl:514

DN:cn=Alice, ou=Sales,dc=contoso,dc=com
changetype:delete

DN:cn=Alice, ou=Sales,dc=contoso,dc=com
changetype:modify
replace:sAMAccountName
sAMAccountName:ContosoAlice
-
replace:userPrincipalName
userPrincipalName:[email protected]
-

执行命令:Ldifde -i -f 222.txt

-----VBS脚本-----
Set objDomain = GetObject("LDAP://dc=contoso,dc=com")
Set objOU=objDomain.Create("OrganizationalUnit","OU=Finance")
objOU.SetInfo
----创建OU
Set objOU=GetObject("LDAP://OU=Finance,dc=contoso,dc=com")
Set objUser=objOU.Create("User","cn=Allen")
objuser.Put "sAMAccountName","Allen"
objuser.Setinfo
objUser.SetPassword "123.com"
objuser.AccountDisabled=FALSE
objuser.Setinfo
----创建用户
Set objOU=GetObject("LDAP://OU=Finance,dc=contoso,dc=com")
Set objGroup=objOU.Create("Group","cn=FinanceGroup")
objGroup.Put "sAMAccountName","FinanceGroup"
objGroup.Setinfo
objGroup.Add objUser.ADSPath
objGroup.SetInfo
---创建组,并且把用户加入组
Wscript.echo "Script Ended Successfully"


-----使用DSADD的命令添加----------
王一,王,一,wangyi,P@ssw0rd
王二,王,二,wanger,P@ssw0rd
王三,王,三,wangsan,P@ssw0rd
王四,王,四,wangsi,P@ssw0rd

C:\>for /f "tokens=1,2,3,4,5 delims=," %a in (test.csv) do dsadd user "cn=%d,ou=
Sales,dc=contoso,dc=com" -samid %d -upn %[email protected] -ln %b -fn %c -pwd %e 
-disabled yes