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

Create users in bulk to the domain

2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

-use CSVDE-

DN,ObjectClass,SAMAccountName,userPrincipalName,displayName,userAccountcontrol

"cn=Alice,ou=HR,dc=contoso,dc=com", user,Alice,Alice@contoso.com,hujintao,512

"cn=Bob,ou=HR,dc=contoso,dc=com", user,Alice,wenjiabao@contoso.com,Alice,512

Execute the command: CSVDE-I-f 111.txt

-use LDIFDE-

DN:cn=Alice, ou=Sales,dc=contoso,dc=com

Changetype:add

ObjectClass:user

SAMAccountName:Alice

UserPrincipalName:Alice@contoso.com

DisplayName:Alice

UserAccountControl:514

DN:cn=Alice, ou=Sales,dc=contoso,dc=com

Changetype:delete

DN:cn=Alice, ou=Sales,dc=contoso,dc=com

Changetype:modify

Replace:sAMAccountName

SAMAccountName:ContosoAlice

-

Replace:userPrincipalName

UserPrincipalName:contosoAlice@contoso.com

-

Execute the command: Ldifde-I-f 222.txt

-VBS script-

Set objDomain = GetObject ("LDAP://dc=contoso,dc=com")

Set objOU=objDomain.Create ("OrganizationalUnit", "OU=Finance")

ObjOU.SetInfo

-create OU

Set objOU=GetObject ("LDAP://OU=Finance,dc=contoso,dc=com")

Set objUser=objOU.Create ("User", "cn=Allen")

Objuser.Put "sAMAccountName", "Allen"

Objuser.Setinfo

ObjUser.SetPassword "123.com"

Objuser.AccountDisabled=FALSE

Objuser.Setinfo

-create a user

Set objOU=GetObject ("LDAP://OU=Finance,dc=contoso,dc=com")

Set objGroup=objOU.Create ("Group", "cn=FinanceGroup")

ObjGroup.Put "sAMAccountName", "FinanceGroup"

ObjGroup.Setinfo

ObjGroup.Add objUser.ADSPath

ObjGroup.SetInfo

-create a group and add users to the group

Wscript.echo "Script Ended Successfully"

-use the DSADD command to add-

Wang Yi, Wang, wangyi,P@ssw0rd

Wang er, Wang, II, wanger,P@ssw0rd

Wang San, Wang, wangsan,P@ssw0rd

Four, four, wangsi,P@ssw0rd.

C:\ > for / f "tokens=1,2,3,4,5 delims=," an in (test.csv) do dsadd user "cn=%d,ou=

Sales,dc=contoso,dc=com "- samid% d-upn% d@contoso.com-ln% b-fn% c-pwd% e

-disabled yes

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