Tạo users tự động

Sau đây là đoạn script dùng để tạo danh sách OU và Users từng phòng ban một cách tự động sử dụng lệnh Dsadd:

  • Tên domain: az-solution.com
  • Tên OU chính: HCMBranch
  • Tên OU phòng ban: HR, IT, Marketing, RD
  • Password mặc định là 122

Dsadd ou ou=HCMBranch,dc=az-solution,dc=com

DSadd group cn=HR,ou=HCMBranch,dc=az-solution,dc=com

DSadd group cn=IT,ou=HCMBranch,dc=az-solution,dc=com

DSadd group cn=Marketing,ou=HCMBranch,dc=az-solution,dc=com

DSadd group cn=RD,ou=HCMBranch,dc=az-solution,dc=com

Dsadd user cn=hr1,ou=HCMBranch,dc=az-solution,dc=com -pwd 123 -upn hr1@az-solution.com -email hr1@az-solution.com -memberof “cn=HR,ou=HCMBranch,dc=az-solution,dc=com”

Dsadd user cn=hr2,ou=HCMBranch,dc=az-solution,dc=com -pwd 123 -upn hr2@az-solution.com -email hr2@az-solution.com -memberof “cn=HR,ou=HCMBranch,dc=az-solution,dc=com”

Dsadd user cn=hr3,ou=HCMBranch,dc=az-solution,dc=com -pwd 123 -upn hr3@az-solution.com -email hr3@az-solution.com -memberof “cn=HR,ou=HCMBranch,dc=az-solution,dc=com”

Dsadd user cn=tpHR,ou=HCMBranch,dc=az-solution,dc=com -pwd 123 -upn tpHR@az-solution.com -email tpHR@az-solution.com -memberof “cn=HR,ou=HCMBranch,dc=az-solution,dc=com”

Dsadd user cn=it1,ou=HCMBranch,dc=az-solution,dc=com -pwd 123 -upn it1@az-solution.com -email it1@az-solution.com -memberof “cn=IT,ou=HCMBranch,dc=az-solution,dc=com”

Dsadd user cn=it2,ou=HCMBranch,dc=az-solution,dc=com -pwd 123 -upn it2@az-solution.com -email it2@az-solution.com -memberof “cn=IT,ou=HCMBranch,dc=az-solution,dc=com”

Dsadd user cn=it3,ou=HCMBranch,dc=az-solution,dc=com -pwd 123 -upn it3@az-solution.com -email it3@az-solution.com -memberof “cn=IT,ou=HCMBranch,dc=az-solution,dc=com”

Dsadd user cn=tpIT,ou=HCMBranch,dc=az-solution,dc=com -pwd 123 -upn tpIT@az-solution.com -email tpIT@az-solution.com -memberof “cn=IT,ou=HCMBranch,dc=az-solution,dc=com”

Dsadd user cn=marketing1,ou=HCMBranch,dc=az-solution,dc=com -pwd 123 -upn marketing1@az-solution.com -email marketing1@az-solution.com -memberof “cn=Marketing,ou=HCMBranch,dc=az-solution,dc=com”

Dsadd user cn=marketing2,ou=HCMBranch,dc=az-solution,dc=com -pwd 123 -upn marketing2@az-solution.com -email marketing2@az-solution.com -memberof “cn=Marketing,ou=HCMBranch,dc=az-solution,dc=com”

Dsadd user cn=marketing3,ou=HCMBranch,dc=az-solution,dc=com -pwd 123 -upn marketing3@az-solution.com -email marketing3@az-solution.com -memberof “cn=Marketing,ou=HCMBranch,dc=az-solution,dc=com”

Dsadd user cn=tpMarketing,ou=HCMBranch,dc=az-solution,dc=com -pwd 123 -upn tpMarketing@az-solution.com -email tpMarketing@az-solution.com -memberof “cn=Marketing,ou=HCMBranch,dc=az-solution,dc=com”

Dsadd user cn=rd1,ou=HCMBranch,dc=az-solution,dc=com -pwd 123 -upn rd1@az-solution.com -email rd1@az-solution.com -memberof “cn=RD,ou=HCMBranch,dc=az-solution,dc=com”

Dsadd user cn=rd2,ou=HCMBranch,dc=az-solution,dc=com -pwd 123 -upn rd2@az-solution.com -email rd2@az-solution.com -memberof “cn=RD,ou=HCMBranch,dc=az-solution,dc=com”

Dsadd user cn=rd3,ou=HCMBranch,dc=az-solution,dc=com -pwd 123 -upn rd3@az-solution.com -email rd3@az-solution.com -memberof “cn=RD,ou=HCMBranch,dc=az-solution,dc=com”

Dsadd user cn=tpRD,ou=HCMBranch,dc=az-solution,dc=com -pwd 123 -upn tpRD@az-solution.com -email tpRD@az-solution.com -memberof “cn=RD,ou=HCMBranch,dc=az-solution,dc=com”

Dsadd user cn=giamdoc,ou=HCMBranch,dc=az-solution,dc=com -pwd 123 -upn giamdoc@az-solution.com -email giamdoc@az-solution.com

Dsadd user cn=Qlykho,ou=HCMBranch,dc=az-solution,dc=com -pwd 123 -upn Qlykho@az-solution.com -email qlykho@az-solution.com

Bạn có thể download file này và sửa thành file bat để thực thi

Create users

About Terri

System Administrator @Netpower Datacenter

Posted on 14.07.2012, in Technical Articles, Windows and tagged , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: