Bulk-add Domain Users in Windows Server 2003

Source: Internet
Author: User

The company now needs to build a domain environment, as a network management has come a live ah. Adding users one by one this is a very unwise choice ah, the user basically has some common attributes, batch processing is more convenient.

Basic Environment: Windows Server 2003 Simplified Chinese + SP2 domain name: milipp.com

Easy to handle with a for statement

We need to create two file for statement files and user files (note: Two files need to be stored in the same place), for statement file we named Add.bat user file we named User.txt

In the Add,bat file I first write the approximate atch code, and then one by one explain.

for/f "token=1,2"%%a in (user.tatchxt) do dsadd user cn=%%a,ou=test,dc=milipp,dc=com-upn%%a@milipp.com-disp Lay%%b-pwd pengfei_001-pwdneverexpires yes-disabled no--acctexpiress never

All right, there are so many things in the change file, is it very simple. The next time our user files User.txt

Basic format is User login name user reality name such as: Test1 Test 1 (Must have spaces in the middle)

It's time to double Add.bat

As shown in figure this is the result of the creation:

User login name, Password never expires, the account is not used in the period, basically the same as the settings in the file!
We still need to be aware that our passwords are compliant with password complexity, and we can use the Pause keyword after the For statement to see if our command was executed successfully. Look at the contents of this hint!

Related Article

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.