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 to add AD users and custom OU users in batches on Windows Server 2008R2

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

Share

Shulou(Shulou.com)06/02 Report--

First of all, here we need to find HR to get the employee's information table, the more detailed the better.

Note: the password should not be too simple, it must meet the requirements of the complexity of the password, otherwise it will prompt the error message.

Then save the table of the modification number to the root directory of disk C.

Add this information below

For / f "skip=1 eol=; tokens=1-10 delims=,"% an in (c:\ aduserdata.csv)

Do dsadd user cn=%a,cn=users,dc=abc123,dc=com

-display a%-upn% c@abc123.com-samid% c-pwd% d-company% e-dept% f

-title% g-office% h-tel% I-fax% j-mobile% k-mustchpwd yes-disabled yes

Reference:

Close the csv file.

Running CMD as an administrator

Command format and parameters of For do

The FOR command iterates through the dsadd command, and the statement in the body of the for program refers to a to get the first symbol

Quote% b to get the second symbol from% averse% z, if your text

There are five columns in the file with values of 1 to 5, and the variable% an is 1, so push it down, and the command line example is as follows:

For / f "skip=1 eol=; tokens=1-9 delims=,"% an 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 skips the first line of data eol=; comment line begins with the character ";" tokens=1-9

Extract 1-9 variables at a time delims=, split the symbol as ","

Where a%, a represents the corresponding information of row An in the EXCEL table.

C% represents the corresponding information of row C in the EXCEL table.

....

What is shown below is the added content, and it is found that there are two places where the information has not been added. There is a slight problem here, which may have something to do with the horizontal length setting of EXCEL.

The added user information is shown below

View user specific information

Let's manually add OU, as shown in the following figure:

Use the second EXCEL table to add OU users in the same way as above. The information saved as "whqxhruser.csv" is omitted here, and no information that cannot be displayed is found when you add it here.

Note: when using the above EXCEL information to add, you need to delete all the users that have been added, otherwise you will report that the user information already exists and saved.

Display user information in OU

Display the specific information of the users in OU

At this point, this paper introduces how to add AD users in batches and how to customize OU and add users to the corresponding OU.

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