Tips and Tricks
Contacts En Masse
Find out how to import Contacts and User Objects into Active Directory, as well as modify batched objects.
Imagine that your company enters into a great new partnership with another
company. Sales will go up, everyone will get raises and all sorts of good
things will happen. Oh, and to ease communications between the companies,
the boss would like you to add all 1,000 of the other company’s employees
to your Active Directory domain as Contacts. Yikes! When does that raise
come?
There’s no need to sweat, because AD comes fully equipped for bulk object
creation. The easiest way in this scenario would be to use Windows’ built-in
support for importing objects from a simple comma-separated values (CSV)
file.
You’ll need to get the other company’s employee info into a CSV file. That can be done using Notepad, or even Microsoft Excel, which makes it a bit easier. Set up seven columns so that the first row contains the column names and subsequent rows contain information about one new Contact object per row. The columns you’ll need are:
ObjectClass. Put “contact” in this column.
DisplayName. Enter the contact name as you want it to appear
in the Global Address List, such as John Doe (Fabrikam).
DN. You’ll need to specify the distinguished name for the new
contact, such as “cn=John Doe,ou=Fabrikam,dc=ourcompany,dc=com” or whatever
is appropriate. Note that this allows you to create the Contact objects
in a separate organizational unit, if you like.
MailNickname. This is the contact’s alias and can be up to 64
characters. You might use something like “ext-JohnD.”
TargetAddress. Here’s where you provide the contact’s real e-mail
address. Use something like “SMTP:john. doe@fabrikam.com” and be sure
to include the SMTP: prefix.
ProxyAddress. This is the user’s e-mail proxy
address within your domain, such as “SMTP:ext-johnd@ourcompany.com.” E-mail
sent to this address will be redirected to the TargetAddress you specify.
Mail. This is the user’s primary SMTP address; use the same SMTP
address you used for ProxyAddress, but omit the SMTP: prefix.
MsExchPoliciesExcluded. This optional eighth column should contain
“{26491CFC-9E50-4857-861B-0CB8DF22B5D7}” if you don’t want Exchange to
automatically generate X.400 and other e-mail addresses for the new contact.
If you omit this column, Exchange will create the additional addresses.
| Batch-Modify
AD |
You can use the more complex LDAP Data Interchange
Format (LDIF), instead of CSV files, if you want to modify
AD objects in batches. The file would be used in conjunction
with the LDIFDE.EXE command-line tool. For example, you
might use LDIFDE to change everyone's business address
and phone number after moving the office, or change the
“reports to” field for everyone in a particular department
after they get a new boss. It's a great way to automate
what would otherwise be a tedious manual process. Read
about it in Windows’ online help or at www.microsoft.com/
windows2000/techinfo/planning/ activedirectory/bulksteps.asp. |
|
|
Once you have all of the data in the Excel spreadsheet, save it as a
CSV file. Then, from a command line, run the CSVDE utility: csvde –i –f
filename.csv. Make sure you’re logged on as a domain administrator or
other user that has permission to create the new Contact objects. Watch
the utility’s output carefully, as it will warn you if you’re trying to
create a new Contact by using a name that’s already in use, or if another
error occurs.
About the Author
With more than fifteen years of IT experience, Don Jones is one of the world’s leading experts on the Microsoft business technology platform. He’s the author of more than 35 books, including Windows PowerShell: TFM, Windows Administrator’s Scripting Toolkit, VBScript WMI and ADSI Unleashed, PHP-Nuke Garage, Special Edition Using Commerce Server 2002, Definitive Guide to SQL Server Performance Optimization, and many more. Don is a top-rated and in-demand speaker and serves on the advisory board for TechMentor. He is an accomplished IT journalist with features and monthly columns in Microsoft TechNet Magazine, Redmond Magazine, and on Web sites such as TechTarget and MCPMag.com. Don is also a multiple-year recipient of Microsoft’s prestigious Most Valuable Professional (MVP) Award, and is the Editor-in-Chief for Realtime Publishers.