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!
Keep Up with TechRepublic