Solved

How to create multiple contacts in AD using scripts

Posted on 2011-09-28
6
1,484 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
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

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article, we will see the basic design consideration while designing a Multi-tenant web application in a simple manner. Though, many frameworks are available in the market to develop a multi - tenant application, but do they provide data, cod…
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
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 to another domain controller. Log onto the new domain controller with a user account t…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

816 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

12 Experts available now in Live!

Get 1:1 Help Now