Link to home
Start Free TrialLog in
Avatar of Babcy
Babcy

asked on

How to create multiple contacts in AD using scripts

How to create multiple contacts in AD using scripts

If possible Tools Also...
ASKER CERTIFIED SOLUTION
Avatar of Stelian Stan
Stelian Stan
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can do this easily with csvde.exe and a csv file.  See the link below for detailed info.  If you need further help just post here and I will be happy to assist.

http://technet.microsoft.com/en-us/library/cc787549(WS.10).aspx

To get the field names just use csvde to export a contact from AD and look at which filed names you want to fill.  to export all contacts from the OU "Contacts" in the domain mydomain.local and save them to c:\output.csv you would use the following.


csvde.exe -e -d "ou=Contacts,DC=mydomain,DC=local" -r "(objectclass=contact") -f c:\output.csv

Open in new window

I had a double quote in the wrong place, correct command for export is below.  Also, csvde was specifically designed by microsoft to do this task.
csvde.exe -e -d "ou=Contacts,DC=mydomain,DC=local" -r "(objectclass=contact)" -f c:\output.csv

Open in new window

Ugh, I'm so sorry, don't use the -e switch; I'm trying to answer you and do something else at the same time and failing at both...
csvde.exe -d "ou=Contacts,DC=mydomain,DC=local" -r "(objectclass=contact)" -f c:\output.csv

Open in new window

Avatar of Babcy
Babcy

ASKER

Thanks Team