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.
This topic is 15 years and 9 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
RTorres9
Posts: 3
Last visit: Wed Aug 16, 2023 10:56 am

Creating users from CSV file in AD

Post by RTorres9 »

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
Last visit: Wed Aug 16, 2023 10:56 am

Creating users from CSV file in AD

Post by RTorres9 »

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
Last visit: Thu May 29, 2008 5:08 am

Creating users from CSV file in AD

Post by donj »

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
Last visit: Wed Aug 16, 2023 10:56 am

Creating users from CSV file in AD

Post by RTorres9 »

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
This topic is 15 years and 9 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked