Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How the server adds users and domain users in bulk

2025-03-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

Xiaobian to share with you how to add users and domain users in batches, I hope you have gained something after reading this article, let's discuss it together!

First of all, there are three ways to add users in batches:

1. Start-Run-CMD

Enter for /l %i in (1,1,50) do net user test%i 123456 /add

Note: (1, 1, 50) means (start value, increment, end value), if you want to decrement (50,-1, 1),test%i is the username, 123456 is the password, the more complex the password setting, the better.

2. If you call this sentence in bat, pay attention to changing %i to %%i

3, or copy the following code to Notepad, save as adduser.bat, run it directly can also be added in batches.

net user test1 123456 /add

net user test2 123456 /add

net user test3 123456 /add

net user test4 123456 /add

net user test5 123456 /add

net user test6 123456 /add

net user test7 123456 /add

net user test8 123456 /add

net user test9 123456 /add

net user test10 123456 /add

4. Batch deletion

Enter for /l %i in (1,1,50) do net user test%i 123456 /del

Let's talk about adding domain users in batches. In WIN2003 AD with dsadd batch add domain users, users and related account attribute information batch add. This is done by looping dsadd through the FOR command. The for statement references %a to get the first symbol and %b to get the second symbol. From %a to %z, if your document has 5 columns with values from 1 to 5, then the variable %a is

1, and so on down, the command line demonstration is as follows:

for /f "skip=1 eol=; tokens=1-9 delims=, " %a in (c:\ADuserdata.csv) do dsadd user cn=%a,cn=users,dc=sample,dc=net -upn %b@sample.net -samid %b -pwd %c -fn %e -ln %d

-dept %f -office %g -title %h -email %i -mustchpwd yes -disabled yes

Parameter meaning: skip=1 skip the first line of data eol=; comment line starts with characters ";" tokens=1-9 extract 1-9 variables delims= at a time, division symbols are ","

In the back of the address had better write absolute address, lest the computer can not find. csv files are best edited using Excel

1. csv file in editing cannot be used by command line, please close Excel and run command line program

2. -fn %e -ln %d The reverse of name position is intentional according to Chinese custom. If it is a foreigner's name, it can also be filled in the last name/first name position in csv file in sequence.

3. For other dsadd parameters see dsadd user /? Tips or from Windows2003 Help documentation.

Corresponding to the sample file ADuserdata.csv content, it is recommended to use Excel to edit:

User Name, Login Name, Password, Last Name, First Name, Department, Office, Position, Email

Bai San, baisan,P@ssw0rd1224, Bai, San, Marketing Department, 301, Manager,baisan@fae.net

Wu Ming, wuming,P@ssw0rd1224, Wu Ming, Marketing Department, 302, Staff,wuming@fae.net

kaola, kaola, P@ssw0rd1224, kaola, marketing, 302, staff,kaola@fae.net

The above has been tested and used normally, but the dsadd command will only be available under the win2003 system.

********************************************************************

Zhang, Li, Zhang Li,ABC,123

Li, Yan, Li Yan,liyang,123

for /f "tokens=1,2,3,4,5 delims=," %a in (users.csv) do dsadd user "cn=%c,ou= Treasury,dc=reskit,dc=msft" -sanid %d -upn %d@reskit.msft -ln &a -fn %b -pwd %e -disabled

yes

Must be saved in csv format

for /f "tokens=1,2,3,4,5 delims=," take out 5 variables from users.csv file,delims separation value is ","

%a in (users.csv) do yes Remove users.csv file

dsadd user "cn=%c,ou= finance department,dc=reskit,dc=msft" create user name is zhang li li yan

-sanid %d login name is abc

-upn %d@reskit.msft upn is the login name

-ln &a is Zhang Li.

-fn %b is name liyan

-pwd %e is Mima 123 123

-disabled yes Yes disabled account

P.S.: While batch additions can help us save a lot of work, migrating servers still requires you to manually add a lot of settings yourself. Because passwords are not portable, they cannot be read directly from the outside. There are also many permissions that cannot be easily implemented in bulk entirely by statements.

After reading this article, I believe you have a certain understanding of "how to add users and domain users in batches to the server." If you want to know more relevant knowledge, please pay attention to the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report