Solved

How to create multiple contacts in AD using scripts

Posted on 2011-09-28
6
1,432 Views
Last Modified: 2012-06-21
How to create multiple contacts in AD using scripts

If possible Tools Also...
0
Comment
Question by:Babcy
6 Comments
 
LVL 23

Accepted Solution

by:
Stelian Stan earned 250 total points
ID: 36718378
0
 
LVL 10

Assisted Solution

by:ienaxxx
ienaxxx earned 250 total points
ID: 36718394
Use the "dsadd contact" command in a batch looping on your list.



@echo off
For /F "usebackq delims=; tokens=1,2,3,4,5,*" %%a IN ("mylist.csv") DO(
 dsadd contact -fn %%a -ln %%b -mi %%c ........**
)

** Assuming you have a semicolon-separated list of contacts with a contact per row and have the First Name in the first column, the Last Name in the second, the middle initials in the third and so on.
Have a look at "dsadd contact /?" for parameters.


P.S.: remember to add more than five tokens if you have more than five columns....

HTH Bye!
0
 
LVL 21

Expert Comment

by:mcsween
ID: 36718419
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

0
 
LVL 21

Expert Comment

by:mcsween
ID: 36718455
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

0
 
LVL 21

Expert Comment

by:mcsween
ID: 36718469
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

0
 

Author Closing Comment

by:Babcy
ID: 36816422
Thanks Team
0

Join & Write a Comment

This is my first article in EE and english is not my mother tongue so any comments you have or any corrections you would like to make, please feel free to speak up :) For those of you working with AD, you already are very familiar with the classi…
Installing a printer using group policy preferences is not that hard let’s take a look at it. First lets open up your group policy console and edit the policy you want to add it to. I recommend creating a new policy for each printer makes it a l…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now