Exchange 2000 incorporates Active Directory from the underlying Windows 2000 Server operating system. When you install Exchange 2000, it creates an object called the Global Address List (GAL) in Active Directory. The recipient lists for your enterprise are stored in the GAL.
You can manipulate the GAL using Exchange 2000’s built-in tools, but that may not be sufficient when you need to make large changes. The Import and Export features provided by the command-line version of Exchange Administrator lets you make mass edits of the GAL using your favorite database or spreadsheet software.
Why would I want to do such a thing?
To get started, let’s build a scenario in which you might want to import and/or export the GAL in your enterprise. Suppose you receive a memo from upper management that informs you that there will be a new standard in e-mail addresses and that every address listed in the Directory must be converted to match this new standard.
In a small network, this task might not strike panic in your heart, but what do you do when you must migrate 50,000 recipients and associated information? You want the comfort of your favorite database or spreadsheet to help you make the changes. Here’s where the ability to import and export data from Exchange 2000’s Global Access List comes in handy.
Getting the files out of Active Directory
The contents of the GAL you extract from Active Directory will be placed into a comma-delimited file to allow editing in Microsoft Access, Excel, or any text editor. To produce this file, start by creating an export options file called Myexport.txt.
On paper, plan out which fields of the GAL’s data you want to export first so you can include them quickly when setting up the export. Here we’ll deal with exporting the entire list. The options file should look as follows:
[export]
basepoint=/o=org
exportobject=mailbox
informationlevel=full
subcontainers=yes
The basepoint= line in the export file is where you’ll specify the starting point of the export; in this case, the o stands for organization level, for which you’ll specify the organization name of the GAL you’re exporting.
The rest of the file is pretty easy to decode. The exportobject= line specifies what you’ll be taking from the GAL; in this case you’ll export mailbox data. The file also indicates that you want all the mailbox data by specifying informationlevel=full and that all subfolders will be exported with thesubcontainers=yes statement.
Now that you’ve created the export file, you can use it in conjunction with a rather simple command-line utility to pull the contents of the GAL. To do so, open a command prompt on your server and type admin {/e | /i} <csvfile> /d <dirservername> [/n] [/o <optionsfile>]. The option switches for this command are as follows:
- The /e and /i switches tell the software which mode to use: Export or Import, respectively.
- Csvfile contains the full path to the comma-delimited file you wish to use for storing this data. In Export mode, if the file exists, the current header information will be used; if not, the default header information will be used when the file is created.
- /d dirservername specifies the Exchange directory server from which you want to retrieve data.
- /n will force the exchange administrator to hide the process dialog box. This can be useful during automated imports and exports to make this invisible to any users or passersby.
- /o optionsfile specifies the file created earlier containing options for this procedure.
So, for example, if you wanted to use the Myexport.txt file discussed above, you’d type admin /e S:\exchange\ourgal.csv /d eserver1 /o myexport.txt and press [Enter]. This will create a comma-delimited file called Ourgal.csv in the Exchange folder on the S: drive of the server.
The great CSV switcheroo
Now that you’ve created the Ourgal.csv file, you can use a program like Microsoft Access to manage the available records. Within Access, you can import the comma-delimited data, which will create fields in a new database that you can use to edit all of the entries with similar attributes at the same time. For example, you might edit all of the records in the text file that contain capital letters by creating a query to select all the records in the file that contain capital letters in the e-mail address field.
Then you might edit these records with another query that will modify only the case of the previously selected data. It may sound like a Herculean task, but it’s nothing when you consider that individually editing 50,000 records would take you much, much longer.
Time factor
It may take a while to import and export the data, so you might want to consider doing it overnight or over the weekend so as not to disrupt the day-to-day flow of business.
Putting things back as you found them
After you’ve retrieved the data from the GAL and edited or modified it in some way, you need to get it back into Active Directory.
When importing new or changed data, you must also create a CSV. The import process will pull in the CSV and, based on specified options, add new entries to the existing GAL and modify any changed records.
The first thing to do is create a CSV for the new employee. It might look something like the following:
[import]
applyntsecurity=yes
createntaccounts=yes
generatepassword=no
ntdomain=yc
Obj-Class,Mode,Directory Name,
Alias Name,Display Name,E-Mail Address,Home-Server
Mailbox,Create,Patricia Smith,
Patricia,Patricia Smith,SMTP:
patricia@yourcompany.net,HSV1
The first section is the options information, which lets Active Directory know what to do with the incoming data. This can be saved separately, but it doesn’t need to be. As stated in that header, Exchange will use NT security, create a new account for the user, and set the account in the domain.
The next information is the header info. This will tell Active Directory which fields in the GAL the incoming data will need. The headers used above are explained below:
- Obj-Class3—the type of object you’re creating
- Mode—The action you wish to take on the GAL using the provided data
- Directory Name—The name of the new object in Active Directory
- Alias Name—The alternate acceptable name for this object
- Display Name—The name of the object as visible in the GAL
- E-mail Address—The e-mail address associated with this object
- Home Server—The home server of this object
The last portion of the file is the data for the new object. This is the data that will be stored in the GAL after the import has completed.
To perform the import, use the Exchange Administrator command-line utility just as before, with the following changes made to the syntax to specify that you’re importing data:
Admin /i S:\exchange\newuser.csv /d eserver1
This will import the above information to the GAL on eserver1.
That’s all there is to it!
The best advice when importing data is to try the tool with a few users at a time until you’ve gained some confidence, and then perform the Mother Of All Imports so you know what to expect. This tool is very easy to handle and can save you a few future headaches, once you’ve mastered it.