[Learning and organizing] Three forms of creating users in Windows server 2019AD domain

Built-in tools csvde.exe, ldifde.exe, dsadd.exe

  • csvde.exe: It can be used to create new user accounts, but cannot be modified. User data needs to be entered into a plain text file
  • ldifde.exe: You can use it to create, delete, and modify user accounts. It is also necessary to enter user data into a plain text file in advance, and then import it into AD
  • dsadd.exe , dsmod.exe , dsrm.exe : dsadd.exe is used to create a new user account, dsmod.exe is used to modify a user account, dsrm.exe is used to delete a user account

1. csvde.exe

Example: use notepad to use

DN,ObjectClass,sAMccountName,userPrincipalName,displayName,userAccounControl

"CN=王,OU=Business Department,DC=hello,DC=com",user,dennis,[email protected],wang,514

"CN=Li,OU=Business Department,DC=hello,DC=com",user,li,[email protected],li,514

DN

DN = "CN=王,OU=Business Department,DC=hello,DC=com",\

ObjectClass

user (object type)

sAMccountName

dennis

userPrincipalName

[email protected] (UPN login name)

displayName

wang: display name

userAccounControl

514 is forbidden, 512 is enabled

2. ldifde.exe

Example: use notepad to use

Create a new user account

DN:CN="hello",OU=ABC,DC=hello,DC=com

changetype:add

sAMAccountName:join

userPrincipalName:[email protected]

displayName:ling

userAccountControl:514

delete a user account

DN:CN=wang,OU=ABC,DC=hello,DC=com

changetype:delete

Modify two attributes of a user account

DN:CN=cheng,OU=ABC,DC=hello,DC=com

changetype:modify

replace:sAMAccountName

sAMAccountName:reboert

-

replace:userPrincipalName

userPrincipalName:[email protected]

-

  • After writing into Notepad, you need to change the format to Unicode when saving
  • If editing on Windows, the format needs to be UTF-16LE

To import the specified domain controller, you need to add the -s parameter

ldifde -s dc1.hello.com -i -f c:\test\user2.txt

3. dsadd.exe

  1. dsadd user "CN=xv,OU=ABC,DC=hello,DC=com" -samid Bob -upn [email protected] -display xv -disabled yes
  2. dsmod user "CN=cheng,OU=ABC,DC=hello,DC=com" -upn [email protected] -pwd 111aaaAAA -tel 123456789
  3. dsrm "CN=wang,OU=ABC,DC=hello,DC=com" -noprompt
  4. pause

The first line: dsadd is a command to create a new user, create a new "CN=xv,OU=ABC,DC=hello,DC=com"

where -samid Bob sets the user sAMAccountName login name to Bob

-upn [email protected] is to set the user UPN login name to [email protected]

-dispaly display name

-disabled yes : Disable user

The second line: dsmod is a modification of the information located in "CN=cheng,OU=ABC,DC=hello,DC=com"

-upn [email protected] Change user UPN to [email protected]

-pwd 111aaaAAA Change the user's password

-tel 123456789 Change the user's phone number to 123456789

The third line: dsrm is used to delete users located in "CN=wang,OU=ABC,DC=hello,DC=com"

The fourth line: pause makes the page pause, which is beneficial for inspection

Note: These three ways of adding users can help us very well when creating multiple users

Guess you like

Origin blog.csdn.net/Huajipu/article/details/128093571