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)
- Deploy a msp-file if Office is already installed
- Deploy a prf-file via a (Group Policy) logon script
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)
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;
- Execute the downloaded OCT for your version to extract it to a convenient location.
- Copy the contents of your Office 2007/2010/2013 installation media to the deployment location.
- 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.
- 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 OCT works for any Office Suite. Be aware of the fact though that the Home and Student version doesn’t contain Outlook.
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
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.
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:
Value name:
Value type:
Value: path to prf-file
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.
'====================================================
' Description: This script determines if a specified mail profile already exists.
' If it doesn't, it will set the path to the prf-file containing
' the mail profile configuration settings.
'
' author : Robert Sparnaaij
' version: 2.0
' website: http://www.howto-outlook.com/howto/deployprf.htm
'====================================================
'=====BEGIN EDITING=====
'Name of mail profile as in the prf-file
ProfileName = "Outlook"
'Path to the prf-file
ProfilePath = "\\server\share\profile.prf"
'Increase the ProfileVersion whenever you want to reapply the prf-file
ProfileVersion = 1
'======STOP EDITING UNLESS YOU KNOW WHAT YOU ARE DOING=====
const HKEY_CURRENT_USER = &H80000001
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & _
strComputer & "\root\default:StdRegProv")
'Determine path to outlook.exe
strKeyOutlookAppPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\OUTLOOK.EXE"
strOutlookPath = "Path"
objRegistry.GetStringValue _
HKEY_LOCAL_MACHINE,strKeyOutlookAppPath,strOutlookPath,strOutlookPathValue
'Verify that the outlook.exe exist and get version information
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(strOutlookPathValue & "outlook.exe") Then
strOutlookVersionNumber = objFSO.GetFileVersion(strOutlookPathValue & "outlook.exe")
strOutlookVersion = Left(strOutlookVersionNumber, inStr(strOutlookVersionNumber, ".0") - 1)
Else
Wscript.Echo "The location of OUTLOOK.EXE couldn not be verified." & vbNewLine & _
"Please contact your system administrator."
WScript.Quit
End If
'Set profile Registry path based on Outlook version
If strOutlookVersion >= 15 Then
strKeyProfilePath = _
"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\" & strOutlookVersion & ".0\Outlook\Profiles\" _
& ProfileName & "\9375CFF0413111d3B88A00104B2A6676"
Else
strKeyProfilePath = _
"Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\" _
& ProfileName & "\9375CFF0413111d3B88A00104B2A6676"
End If
'Check if a mail profile already exists
strLastChangeVer = "LastChangeVer"
objRegistry.GetBinaryValue _
HKEY_CURRENT_USER,strKeyProfilePath,strLastChangeVer,strValueLastChangeVer
'Check if the prf-file needs to be reapplied
If ProfileVersion > 1 Then
strKeyProfileVersionPath = "SOFTWARE\HowTo-Outlook\DeployPRF"
strProfileVersionName = ProfileName
objRegistry.GetDWORDValue _
HKEY_CURRENT_USER,strKeyProfileVersionPath,strProfileVersionName,strValueProfileVersion
If IsNull(strValueProfileVersion) OR ProfileVersion > strValueProfileVersion Then
ReapplyPrf = True
End If
End If
'Apply the prf-file if needed
If IsNull(strValueLastChangeVer) OR ReapplyPrf Then
'The mail profile doesn't exist yet so we'll set the the ImportPRF key and remove the FirstRun keys
'Verify that the configured prf-file exist
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(ProfilePath) Then
'Create the Setup key, set the ImportPRF value and delete the First-Run values.
strKeyOutlookSetupPath = "SOFTWARE\Microsoft\Office\" & strOutlookVersion & ".0\Outlook\Setup"
strImportPRFValueName = "ImportPRF"
strImportPRFValue = ProfilePath
objRegistry.CreateKey HKEY_CURRENT_USER,strKeyOutlookSetupPath
objRegistry.SetStringValue HKEY_CURRENT_USER,_
strKeyOutlookSetupPath,strImportPRFValueName,strImportPRFValue
strFirstRunValueName = "FirstRun"
objRegistry.DeleteValue HKEY_CURRENT_USER,_
strKeyOutlookSetupPath,strFirstRunValueName
strFirstRun2ValueName = "First-Run"
objRegistry.DeleteValue HKEY_CURRENT_USER,_
strKeyOutlookSetupPath,strFirstRun2ValueName
'Save the applied ProfileVersion if larger than 1.
If ProfileVersion > 1 Then
objRegistry.CreateKey HKEY_CURRENT_USER,strKeyProfileVersionPath
objRegistry.SetDWORDValue HKEY_CURRENT_USER,_
strKeyProfileVersionPath,strProfileVersionName,ProfileVersion
End If
Else
Wscript.Echo "Crucial file in script could not be found." & vbNewLine & _
"Please contact your system administrator."
End If
Else
'The mail profile already exists so there is no need to launch Outlook with the profile switch.
'Of course you are free to do something else here with the knowledge that the mail profile exists.
End If
'Cleaup
Set objRegistry = Nothing
Set objFSO = Nothing
Click in the area above and press CTR+A to select all. Press CTRL+C to copy the code.
Click in the area above and press CTR+A to select all. Press CTRL+C to copy the code.
沒有留言:
張貼留言