How to bulk Add ad users and Custom OUs on Windows Server 2008r2

Source: Internet
Author: User
Tags eol

First of all, we need to find HR to staff information table, the more detailed the better

Note: The password can not be too simple, be sure to meet the complexity of the requirements of the password, or will prompt an error message

Then save the modified number table to the root of the C drive.

Add this information below
for/f "Skip=1 eol=; Tokens=1-10 delims=, "%a in (c:\aduserdata.csv)
Do dsadd user cn=%a,cn=users,dc=abc123,dc=com
-display a%-upn%[email protected]-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

When you run cmd as an administrator

command format and parameters for-do

The for command loops through the dsadd command, which refers to the%a to get the first symbol,

Reference%b to get the second symbol from%A~%Z, if your text
There are 5 columns in the file is the value of the%a, the variable is 1, as follows, the command line is shown below:

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%[email protected]-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 row of data eol=; The comment line starts with the character ";" Tokens=1-9
Each time you extract 1-9 variable delims=, the split symbol is ","

Where a%, a represents the corresponding information of line A in the Excel table
c% represents the corresponding information for the C line in the Excel table.
....

As shown below is the added content, found that there are two information has not been added, here is a little bit of a problem, perhaps with Excel's horizontal length setting has a relationship

Add the user information as shown below

View user specific information

The following initiator adds the OU as shown in:

Using the second Excel table, adding users to the OU in the same way as above, omitting the information saved as "Whqxhruser.csv", where it was added that no information could be displayed.

Note: In the use of the above Excel information to add, you need to remove the user has been added, or will be reported to add the user information already exists save

Display user information in OU

Display specific information about the user within the OU

Here, how to add ad users in bulk and how to customize OUs to add users to the corresponding OUs method

How to bulk Add users to ad users and custom OUs on Windows Server 2008r2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.