Batch Add Active Directory Account

xiaoxiao2021-03-06  14

Save the following code as a BB.vbs file.

Set objou = getObject ("ldap: // cn = users, dc = domain, dc = COM")

Const ForReading = 1Set objFSO = CreateObject ( "Scripting.FileSystemObject") Set objTextFile = objFSO.OpenTextFile ( "a.txt", ForReading) 'file format' account, the display name 'such as: test, test' zhenghai, had sea

Do Until objTextFile.AtEndOfStream strNextLine = objTextFile.Readline arrList = Split (strNextLine, ",") Set objUser = objOU.Create ( "User", "cn =" & arrList (1)) objUser.Put "sAMAccountName", arrList ( 0) Objuser.Put "DisplayName", arlist (1)

Objuser.put "description", "gz" objuser.setinfo

Set objuser = getObject ("LDAP: // CN =" & Arrlist (1) & ", cn = users, dc = domain, dc = com") Objuser.SetPassword "cm" loop

Then create a new text file in the same directory, named A.txt.

The content of the file is: (note, don't have spaces)

Test, test zhenghai, Zenghai

You can join on the Windows 2000 Server host installed on the AD.

Other information on setting an account can be referred to MSDN

转载请注明原文地址:https://www.9cbs.com/read-48314.html

New Post(0)