Automatically Generate Mail Profiles

Use the CIW to customizing Outlook 2003 installations

Joseph Neubauer

June 25, 2006

9 Min Read
ITPro Today logo in a gray background | ITPro Today

Time is money, and IT support staff or end users don't need to waste time manually supplying the username and mailbox server name that Microsoft Office Outlook 2003 needs to open an Exchange mailbox. I've come up with a solution that leverages Outlook features to automate the time-intensive task of creating mail profiles. To use this solution, you need to have the necessary tools and obtain a few pieces of information.

The Necessary Tools
To take advantage of the Outlook features that let you automatically configure mail profiles, you need the Microsoft Office 2003 Resource Kit (ORK), which you can download from the Office Resource Kit Web page (http://office.microsoft.com/ork). In ORK, you'll find the Custom Installation Wizard (CIW). CIW creates a Microsoft transform (.mst) file that Outlook's setup.exe program reads during installation. The .mst file contains information about the modifications you want to make to Outlook's initial setup. The information includes definitions that let you override the default installation settings. For example, by default, Outlook is configured to let users choose whether they want to send a return receipt when one is requested. If you want to change this setting so that sending a return receipt is the default option, you can use CIW to create an .mst file that tells setup.exe to use the new setting as the default option when it installs Outlook.

The Necessary Information
For Outlook to automatically generate a user's mail profile, it needs certain information. To begin, it needs to know the name of the mailbox to access. Users might not know their exact mailbox name, so Outlook searches for a mailbox based on what's entered in the User Name field in the Outlook dialog box that Figure 1 shows. This search, called the mailbox name-resolution process, is performed by matching text against four mailbox fields: Display Name, Alias Name, Last Name, and First Name. If a match is found, Outlook knows which mailbox to reference in the profile.

Outlook can use an environment variable to fill in the User Name field so that the mailbox name-resolution process can determine the mailbox to access. In most cases, the variable used is %USERNAME% because users' domain account names are usually the same as their mailbox aliases. The %USERNAME% variable holds the name of the account currently used to log on to the workstation. For example, if I log on to my workstation as NEULANNeubauer, %USERNAME% will hold the domain account name Neubauer. If I log on to my workstation as a local administrator, %USER-NAME% will hold the local account name Administrator. Knowing what %USERNAME% will hold is important. If the variable doesn't hold a value that matches a value in one of the four mailbox fields just mentioned, Outlook won't be able to locate the mailbox and the user will be prompted to help Outlook configure the profile. In the rare instances when using %USERNAME% is problematic (e.g., Exchange is in a different forest from the AD accounts, and the forests don't use a common naming convention), you can use a script to prepopulate a different environment variable with a value that can be used in the mailbox name-resolution process. Another piece of information that Outlook needs to automatically generate a mail profile is the name of an Exchange mailbox server. Outlook will use this server to perform the mailbox name-resolution lookup. When selecting the mailbox server, keep in mind these considerations:

  • Pick a server that's available. The mailbox name-resolution process doesn't put any significant load on the server, but the server needs to be online. The process will fail if you specify a server that's later removed from your environment.

  • Pick a server that's centrally located in your network. If your users access email over a WAN and your mailbox servers aren't centralized on a single subnet, pick a server that's centrally located. That way, Outlook doesn't need to traverse too many routers.

  • Pick a server that's used by the most people. For example, suppose you have two servers, EX01 and EX02, which are in different geographic locations (e.g., California and New York). If 90 percent of your users use EX01, it doesn't make sense to specify EX02.

Unlike the mailbox name, the mailbox server name can't be specified in an environment variable. You must hard-code the information in CIW. Although Outlook and CIW are incapable of dealing with an environment variable for the server name, there are two ways you can make the mailbox name-resolution process more robust. The first approach is to create multiple .mst files that are customized on a site-by-site basis. This is the way to go if you also have to implement a variety of other custom Outlook settings (e.g., one site wants users to be able to choose to send return receipts and another doesn't).

The second approach is to use a DNS alias to abstract the name of the mailbox server. For example, you can create a DNS CNAME record called Outlook that references the EX01 server. Instead of specifying EX01 as the mailbox server, you specify outlook.domain.com. When Outlook attempts to connect to the outlook .domain.com server, the workstation will query DNS, which returns EX01's IP address. Outlook then connects to EX01 to perform the mailbox name-resolution. Because the resolution process returns the names of the server and the mailbox, Outlook replaces outlook.domain.com with the correct server name and creates the profile.

With the DNS approach, you can quickly and easily change which server performs the mailbox name resolution in the event the original server is retired or temporarily offline. To make the change, you simply update the CNAME definition in DNS. This approach also extends the life of your Office or Outlook installation custom deployment because you don't need to update the deployment on every workstation to use a new server name. Because of these benefits, I use the DNS approach in the step-by-step instructions given in the next section.

In a WAN environment, if you want a server that's close to your users to perform the name resolution, you can use a similar DNS trick to force Out-look to query a local server. In addition to creating the CNAME record in DNS, you can add an entry to the HOSTS file in the %systemroot% system32drivers folder on workstations that aren't local to the server referenced in the CNAME record. The HOSTS file is always checked before a DNS query is made. So, instead of using DNS to find the IP address for outlook.domain.com, the workstation gets the IP address from the HOSTS file. If you use the HOSTS file method, don't skip creating a CNAME record. The CNAME definition will ensure that the mailbox name-resolution process continues to function in the event the outlook .domain.com entry is removed from the HOSTS file.

The Necessary Configurations
To configure your system to automatically generate mail profiles, follow these steps:

1. Copy the contents of the Micro-soft Office 2003 or Outlook 2003 CDROM to a network share. If you haven't already done so, install ORK on your workstation.

2. Launch CIW. On all CIW's pages, you can accept the default settings or configure them to suit your needs, unless I mention a specific setting or action.

3. On page 2, click the Browse button and specify the path to the Out-look MSI file (outls11.msi). You'll find this file on the network share on which you copied the CD-ROM contents.

4. On page 3, select Create new MST file. Place the .mst file on the same share as the Outlook source files.

5. On page 4, specify a meaningful filename for your .mst file, such as AutoConfigure.mst.

6. Click through pages 5 through 16. In these pages, you can specify installation options, but those options aren't relevant for this solution.

7. On page 17, select the New profile option and specify a profile name (e.g., Exchange Mailbox). The profile name must be hard-coded.

8. On page 18, select the Configure an Exchange Server connection option. In the User Name field, enter the environment variable that will be used to resolve the mailbox name (e.g., %USERNAME%). If you're sure the environment variable's value will exactly match the mailbox's alias, precede the environment variable with an equal (=) sign, as Figure 2 shows. Outlook typically uses its ambiguous name-resolution algorithm to find mailboxes that have a partial match. The equal sign tells Outlook to match the value exactly. In the Exchange Server field, enter outlook.domain.com.

9. On page 19, you can add additional services. I recommend you add the Outlook Address Book service so that users can use names in their Contacts lists when addressing mail. To add this service, select the Customize additional Outlook profile and account information option. Set the Deliver new mail to the following location option to Exchange Server. Click the Add button and choose Outlook Address Book. Click Next, then Finish.

10. Click through pages 20 through 23. The options on these pages aren't relevant for this solution.

11. On page 24, click Finish to prompt CIW to generate your .mst file. The completion screen will provide the command you need to use to run the Office or Outlook setup program. Write down this command, which will look something like

\APPS01SoftwareOutlook2003 setup.exe TRANSFORMS=  \APPS01SoftwareOutlook2003 AutoConfigure.mst /qb 

12. On your DNS server or an administrative workstation, open the Microsoft Management Console (MMC) DNS Management snap-in and connect to your DNS server.

13. Highlight your domain, right-click it, select New, then select New Alias (CNAME). In the New Resource Record dialog box, enter Outlook (don't specify a domain) in the top text box, as Figure 3 shows. In the bottom text box, enter the Exchange server's Fully Qualified Domain Name (FQDN). Click OK and exit the snap-in.

It s Time for Deployment Now all that's left to do is run the command you wrote down in step 11. The setup program will then install Outlook on all the users' workstations. The first time the users log on to Windows and start Outlook, Outlook will quickly and quietly use the environment variable value and CNAME DNS server alias to automatically create and configure their mail profiles.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like