Deploy Outlook mail profile settings via GPO or script

When an end-user starts Outlook for the first time in a managed environment, he or she usually expects that Outlook is fully configured already and simply opens to the Inbox. Being a good administrator, you obviously want to create this experience for your users as well.

AutoDiscover in Exchange 2007 and later together with Auto Account Setup (or AutoConfigure) in Outlook 2007 and later alleviates some of this pain already by presenting the user with dialogs for which they only have to click Next and Finish or prompt them to supply commonly known information such as their email address and password. Outlook then figures out the technical configuration itself and has the user quickly up and running.

As this still requires end-user interaction, which could lead to confusion or errors, you can take this a step further by deploying Outlook mail profile settings. The Office installation offers various options for this.


Deploy Office with a customization file (msp-file)

Directly deploying Outlook mail profile settings when deploying Office is the best way to go. By using the Office Customization Tool (OCT) you can prepare your deployment and specify default settings for your users including Outlook mail profile settings.

Download: Office 2007 Office Customization Tool (OCT)
Download: Office 2010 Office Customization Tool (OCT)
Download: Office 2013 Office Customization Tool (OCT)

Installing and running the OCT

To be able to use the OCT you must do the following;

  1. Execute the downloaded OCT for your version to extract it to a convenient location.
  2. Copy the contents of your Office 2007/2010/2013 installation media to the deployment location.
  3. Copy the Admin folder from the extracted OCT location to the installation directory of your Office deployment folder.
    • If your installation DVD contains both the 32-bit and the 64-bit version of Office 2010 or Office 2013, you’ll have to copy it to the x86 or x64 folder, respectively.
  4. Start setup.exe from the deployment location with the /admin switch;
    setup.exe /admin

Note:
The OCT works for any Office Suite. Be aware of the fact though that the Home and Student version doesn’t contain Outlook.

The mail profile can be configured in the Outlook section of the OCT. (click on image to enlarge)
The mail profile can be configured in the Outlook section of the OCT.
(click on image to enlarge)

Deploying Office with the msp-file

Once you’ve configured all the settings that you want, use File-> Save As… to save the msp-file to the Updates folder of your Office deployment folder. When Office is being installed, it will automatically apply the msp-file and configure the settings for the user.

For further customizations required to deploy Office 2010 or Office 2013 via a GPO see;
Deploy Office 2013 by using Group Policy computer startup scripts

Bug:
Outlook 2010 SP1 introduced a bug which affects the function of importing a prf-file when it contains settings for an Exchange account. To properly process the prf-file, you must set the OverwriteExisitingService value in Section 4 of the prf-file to Yes (open the prf-file in Notepad to make the changes);
OverwriteExisitingService=Yes

This OverwriteExistingService setting applies to Section 6 and Section 7 of the prf-file and not to any already configured mail profile or mail account which are controlled by the OverwriteProfile and ModifyDefaultProfileIfPresent options in Section 1.

To apply this customization when creating an msp-file, export the prf-file, make the customization and then set the OCT setting to Apply PRF and point it to the modified prf-file.

Without this modification, Outlook will ignore the configuration specified in the prf-file and start the “Microsoft Outlook 2010 Startup Wizard” as usual.

This issue has been first fixed in hotfix KB2584053 and is also included in later updates.

Deploy a msp-file if Office is already installed

If Outlook 2007, Outlook 2010 or Outlook 2013 is already installed on the client computers, you can create a new msp-file via the OCT which only holds mail profile settings and nothing else. You can then deploy this msp-file.

This deployment can be done via Microsoft System Center Configuration Manager or via a different deployment application within your organization.

If you want to do this via a Group Policy, you’ll have to do it via a startup script as the installation requires Administrator level rights. Since users usually don’t have installation rights, a logon script will fail. The command to use in your startup script would be similar to;

msiexec.exe /p "\\server\share\custom.msp"

Outlook 2003
If you are still using Outlook 2003, then you can use the Office Resource Kit (ORK) to create a Custom Maintenance Wizard File (cmw-file). To apply this to your users, deploy the Maintwiz.exe file to the Office directory of the user’s machine and execute it with a the location of the cmw-file as the parameter in a GPO startup script.

"C:\Program Files\Microsoft Office\Office\Maintwiz.exe" "\\server\share\custom.cmw"

Deploy a prf-file via a (Group Policy) logon script

The OCT or ORK also allows you to export the Outlook mail profile as a prf-file. This prf-file can then be distributed to your users via a logon script. As logon scripts work on user instead of computer level, it will allow you to more easily deploy different mail profiles to different sets (Organizational Units) of users. Outlook offers 2 built-in mechanisms for this.

/importprf startup switch

One method is to import prf-files via the /importprf command line switch. The downside of this command line is that it will also directly launch Outlook and will execute at each logon and could therefore possibly also modify end-user alterations to the mail profile.

ImportPRF Registry value

The ImportPRF Registry value has the benefit that it can be set without needing to open Outlook. The first time that Outlook is launched, Outlook will look at this value and if it is set, it will use the specified prf-file to configure Outlook.

Key: HKEY_CURRENT_USER\Software\Microsoft\Office\<version>\Outlook\Setup
Value name: ImportPRF
Value type: REG_SZ
Value: path to prf-file

For this Registry value to work, the FirstRun and First-Run value may not exist in the Setup key.

Deployment script

While setting the key for the fist time isn’t hard to do, once the FirstRun or First-Run values have been set, updating the mail profile without ending up applying it each time the user logs on is a bit more complicated. To prevent this, you can use the vbs-script below which has the following characteristics.

  • Checks if the profile already exists. If it does, it won’t import the prf-file again.
  • Allows for setting a version for your prf-file. By increasing the version in the script, you can force the (updated) prf-file to be reapplied again.
  • It doesn’t start Outlook.
  • Can be used as a (Group Policy) logon script.
  • Works at user-level rights.
  • Works for all versions of Outlook.

Download: deployprf.zip

The following code is contained in the zip-file download. You can use the code below for review or manual creation of a vbs-script.


Click in the area above and press CTR+A to select all. Press CTRL+C to copy the code.