Creating users from CSV file in AD

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
User avatar
RTorres9
Posts: 3
Joined: Wed May 28, 2008 7:53 am

Creating users from CSV file in AD

Post by RTorres9 » Wed May 28, 2008 7:53 am

Hello, I need some assistance in creating a script that will read data from a CSV file and create a new user in the right OU from this information. For unknow reasons the script fails right at the moment of when I use the command of "objUser.SetInfo". The error message is " A constraint violation occurred." Please advise any assistance would be greatly appreciated!! Please see the attached documuploads/27202/pretest.txtents.

User avatar
RTorres9
Posts: 3
Joined: Wed May 28, 2008 7:53 am

Creating users from CSV file in AD

Post by RTorres9 » Wed May 28, 2008 7:53 am

Hello, I need some assistance in creating a script that will read data from a CSV file and create a new user in the right OU from this information. For unknow reasons the script fails right at the moment of when I use the command of "objUser.SetInfo". The error message is " A constraint violation occurred." Please advise any assistance would be greatly appreciated!! Please see the attached documuploads/27202/pretest.txtents.

User avatar
donj
Posts: 416
Joined: Thu Nov 16, 2006 9:02 pm

Creating users from CSV file in AD

Post by donj » Thu May 29, 2008 5:08 am

Probably the easiest way to do this is in Windows PowerShell using the cmdlets from www.quest.com/powershell.

Import-CSV <filename> | ForEach-Object { New-QADUser -ou <ou_name> -property $_.column }

Replace -property with the AD property name (as in, -city, -samaccountname, -sn, or whatever). Replace $_.column with the column name from the CSV (as in, $_.CityName, $_.LogonName, $_.LastName or whatever).

PowerGui.org provides support forums for those cmdlets.

User avatar
RTorres9
Posts: 3
Joined: Wed May 28, 2008 7:53 am

Creating users from CSV file in AD

Post by RTorres9 » Thu May 29, 2008 5:42 am

Hi Donj,
Thanks for looking into my issue. I'm not familiar at all with PowerShell or profecient with VB scripts as you could see. However I will look into the PowerGUI web site. Once I get this part of the script going. I see it extending it into where I'll be using decision making process in placing the new users object into different container based on thier site location which will be identifed in a colume in the CSV file.
I noticed that thier are examples of using Powershell with Exchange management. Would Powershell work for scripts for Lotus Notes mailboxes? Please advise, RTorres9

Locked