General discussion

Locked

DOWNLOA Create users in Active Directory from a CSV file with VBScript

By Bill Detwiler Editor ·
Creating users can be tedious, especially when user information already resides in your company's HR system. Instead of manually creating a user and assigning passwords, you can use a script that accomplishes the same goal. The benefits: Fewer iterations of the information will result in fewer errors; you don't need to worry about whether or not a user account gets created; and, you can focus on more strategic IT tasks. This handy, VBScript will create users with passwords in Active Directory in the Users container.

Download and try the script:
http://techrepublic.com.com/5138-10877-6019533.html

Join this ongoing discussion and let us know if this script is helpful and if there's anything we can do to improve the download's format or content.

This conversation is currently closed to new comments.

21 total posts (Page 1 of 3)   01 | 02 | 03   Next
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Loop Missing

by bowlsys In reply to DOWNLOAD: Create users in ...

The script appears to have a missing loop statement

Collapse -

not really missing a loop statement here is the fix

by darrick.wilson In reply to Loop Missing

I fixed it. I found out that it was the select statement in this script. The concatenation of sCSVfile with the select statement was not working right. Here is what I changed it to.

oInputRecordSet.open "SELECT * FROM example.csv", oInputConnection

Rather than calling the variable since that was not working right I put the name of the file in the select statement.

I also made a change to the oContainer getobject because I wanted to populate to an OU and not the users container.

Set oContainer = GetObject("LDAP://OU= Name,dc=example,dc=com")

Also this is a common error message -2147016657. It is in reference to exchange sLDAPExchangeServer or sLDAPhomeMDB. Check the values for these two variables again from the exchattrib.csv file. This error message is hard to find why this happens.

Here is one more change I made. The reason why I hard coded this was because again the concatenation of this line was not working write.

oNewUser.put "mail", lcase(SLogon) & "@example.com"

I really wanted to say thank you for creating this script it works great with a couple of tweaks but overall GREAT JOB!

Collapse -

CSV file the script looks for

by john.tsang In reply to DOWNLOAD: Create users in ...

The script looks for the "example.csv" file but I not really sure what to put in here?

Thanks

Collapse -

look for csv file layout from parameters

by darrick.wilson In reply to CSV file the script looks ...

Look for section titled "' --------- Start creating user account
' Read variable information from the CSV file
' and build everything needed to create the account"

Then look that the value for each variable
item(0) = column A
item(1) = column B

and so on.

Collapse -

Exchange attributes error : -2147016694

by jfaraone In reply to CSV file the script looks ...

Anyone have an idea of what this could mean?

Collapse -

Try to hard code those variables

by darrick.wilson In reply to Exchange attributes error ...

I would hard code the variables in section titled ?Build and write the users Exchange attributes?. One of those variables is incorrect. Either it is the concatenation of that string or string is incorrectly formatted. Did you get your values from your csv dump of you ldap?

Collapse -

Legacy Mailbox

by ondererunsal In reply to Try to hard code those va ...

The script works when you carrefully add the correct variables, but it creates the mailboxes as legacy mailbox and I even dont have any legacy exchange server. Is there anybody with the same problem?

Collapse -

Set user account to not change passwords at next login

by darrick.wilson In reply to DOWNLOAD: Create users in ...

I have been trying to set the user accounts so they did not have to change their passwords at next login. We are setting this up for DR purposes and if you login over Outlook Web Access it does not give you the option to change your password at login. Here is what you need to set in the script to not have them change password at next login.

oNewUser.Put "pwdLastSet", -1

Collapse -

Required string to read next in CSV

by shannon.ross1 In reply to DOWNLOAD: Create users in ...

Ensure you add the following at the end of the script so it reads the next line in the CSV file:

oRecordSet.MoveNext
loop

Collapse -

User Discription

by leen_nsp In reply to Required string to read n ...

Is It also possible to add a user discription?

Back to IT Employment Forum
21 total posts (Page 1 of 3)   01 | 02 | 03   Next

Related Discussions

Related Forums