[gptalk] Re: GPO to Configure Outlook 2003 for Exchange 2007

  • From: "Nelson, Jamie R" <Jamie.Nelson@xxxxxxxxxxxxxxxxxxx>
  • To: <gptalk@xxxxxxxxxxxxx>
  • Date: Fri, 25 Jan 2008 08:53:41 -0600

Don't know how much you know about writing a PRF file, but you can read
more here:

http://office.microsoft.com/en-us/ork2003/HA011402581033.aspx

Basically you can manually create the file yourself or use the Custom
Installation Wizard to generate one for you. Either way, it's pretty
easy. When writing the PRF file, use %USERNAME% for MailboxName.

 

Two methods you can try using a PRF:

 

1)      Write an ADM to tattoo the attached registry settings
(ImportPRF.txt). By doing so, you can make all "new" profiles use a
centralized PRF file for configuration. I've done this before in the
past and it has worked very well. The only drawback to this is that you
might have some instances where %USERNAME% may not necessarily be the
same as the user's mailNickname and you might run into issues resolving
a mailbox.



2)      Run the attached script (ConfigOutlookProfile.vbs - remove the
.txt from the extension name) through Group Policy (user logon script)
to configure new and/or existing profiles with a custom PRF. Keep in
mind that existing profiles will get overwritten when this runs, so if
they have a bunch of PSTs and other junk in their profile it will need
to get re-configured. The script should only run once, as it dumps a
flag file (ConfigOutlookProfile.flg) in the root of the user's profile
directory. If you do have a need for it to run again, just delete the
file.

The script will automatically replace %USERNAME% with the correct
mailNickname for the user so that mailbox discovery occurs without any
problems. I only did this because it's possible that the sAMAccountName
may not match the mailNickname attribute, although it should in most
cases.

The script method works for Outlook 2000/XP/2003/2007 so it is a little
more dynamic. If it will be configuring Outlook 2000 clients, you will
need to download the modprof.exe file and place it in the same folder
the script is running from. The PRF file you are using as a template
must also be in the same location as the script.

 

Hope this helps you out.

 

Regards,

Jamie Nelson

 

 

From: gptalk-bounce@xxxxxxxxxxxxx [mailto:gptalk-bounce@xxxxxxxxxxxxx]
On Behalf Of EIS Lists
Sent: Thursday, January 24, 2008 9:29 PM
To: gptalk@xxxxxxxxxxxxx
Subject: [gptalk] Re: GPO to Configure Outlook 2003 for Exchange 2007

 

Thanks. I'll have a look.

 

 

 

From: gptalk-bounce@xxxxxxxxxxxxx [mailto:gptalk-bounce@xxxxxxxxxxxxx]
On Behalf Of Darren Mar-Elia
Sent: Thursday, January 24, 2008 7:09 PM
To: gptalk@xxxxxxxxxxxxx
Subject: [gptalk] Re: GPO to Configure Outlook 2003 for Exchange 2007

 

I know that you can't set user and servername using the ADM templates.
You might have a look at the Custom Profile Wizard that comes with the
Office 2003 Resource Kit. I can't remember exactly, but I think it lets
you set those after the fact using a logon script and the profile file
that it creates.

 

Darren

 

From: gptalk-bounce@xxxxxxxxxxxxx [mailto:gptalk-bounce@xxxxxxxxxxxxx]
On Behalf Of EIS Lists
Sent: Thursday, January 24, 2008 6:51 PM
To: gptalk@xxxxxxxxxxxxx
Subject: [gptalk] Re: GPO to Configure Outlook 2003 for Exchange 2007

 

Thanks Darren. With deployments of Outlook 2003 (where I am deploying
the new application), I was able to set the server name and user name to
defaults. The user name field used a variable (effectively %username%)
so that basically, the user just launched Outlook and was setup
automatically. Is such a thing possible with the scenario I've
described?

 

Thanks.

 

From: gptalk-bounce@xxxxxxxxxxxxx [mailto:gptalk-bounce@xxxxxxxxxxxxx]
On Behalf Of Darren Mar-Elia
Sent: Thursday, January 24, 2008 6:34 PM
To: gptalk@xxxxxxxxxxxxx
Subject: [gptalk] Re: GPO to Configure Outlook 2003 for Exchange 2007

 

I think what you'll find is that using the office 2003 ADM templates,
you can configure many of the options within Outlook, with the large
exception of the exchange profile itself. What specifically are you
looking to configure?

 

Darren

 

From: gptalk-bounce@xxxxxxxxxxxxx [mailto:gptalk-bounce@xxxxxxxxxxxxx]
On Behalf Of EIS Lists
Sent: Thursday, January 24, 2008 6:28 PM
To: gptalk@xxxxxxxxxxxxx
Subject: [gptalk] GPO to Configure Outlook 2003 for Exchange 2007

 

Hello:

 

We are planning to roll out Exchange 2007 and would like a way to easily
configure the Outlook client to connect to it. We have a small but
geographically distributed network. Domain is 2003, all Outlook clients
are 2003. None of the Outlook installs were done via GPO - all
pre-installed and RIS deployed workstations. Total users are about 120. 

 

Any shortcuts for configuring Outlook? (I know this can be done during
initial deploy with a transform.)

 

Thanks.

 

 

 

**********************************************************************
This e-mail may contain identifiable health information that is subject to 
protection under state and federal law. This information is intended to be for 
the use of the individual named above. If you are not the intended recipient, 
be aware that any disclosure, copying, distribution or use of the contents of 
this information is prohibited and may be punishable by law. If you have 
received this electronic transmission in error, please notify us immediately by 
electronic mail (reply).


This e-mail may contain identifiable health information that is subject to 
protection under state and federal law. This information is intended to be for 
the use of the individual named above. If you are not the intended recipient, 
be aware that any disclosure, copying, distribution or use of the contents of 
this information is prohibited and may be punishable by law. If you have 
received this electronic transmission in error, please notify us immediately by 
electronic mail (reply).
ÿþWindows Registry Editor Version 5.00



[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0\User
 Settings]

"Order"=dword:00000006



[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0\User
 
Settings\{86428788-BD4E-4EEA-A893-B46C8F4FB361}]

"Count"=dword:00000001

"Order"=dword:00000006



[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0\User
 
Settings\{86428788-BD4E-4EEA-A893-B46C8F4FB361}\Create]



[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0\User
 
Settings\{86428788-BD4E-4EEA-A893-B46C8F4FB361}\Create\Software]



[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0\User
 
Settings\{86428788-BD4E-4EEA-A893-B46C8F4FB361}\Create\Software\Microsoft]



[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0\User
 
Settings\{86428788-BD4E-4EEA-A893-B46C8F4FB361}\Create\Software\Microsoft\Office]



[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0\User
 
Settings\{86428788-BD4E-4EEA-A893-B46C8F4FB361}\Create\Software\Microsoft\Office\11.0]



[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0\User
 
Settings\{86428788-BD4E-4EEA-A893-B46C8F4FB361}\Create\Software\Microsoft\Office\11.0\Outlook]



[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0\User
 
Settings\{86428788-BD4E-4EEA-A893-B46C8F4FB361}\Create\Software\Microsoft\Office\11.0\Outlook\Setup]

"ImportPRF"="\\\\MYSERVER\\MYSHARE\\OutlookProfile.prf"



'///////////////////////////////////////////////////////////////
'Name: ConfigOutlookProfile.vbs
'Author: Jamie Nelson
'Version: 2.2
'Purpose: Automatically configures the Outlook profile with the correct
'                 Microsoft Exchange mailbox.
'-----------Date--------Version-----ChangeLog-------------------
'History:       25 Mar 04       1.0                     Initial code developed.
'                       03 Aug 04       2.0                     Streamlined 
code. Took out need to copy .prf and modprof.exe
'                                                                       utility 
locally. Now runs from script location.
'                       09 Jan 06       2.1                     Generalized 
code for Group Policy implementation. Removed
'                                                                       logging 
features and IfMember checks.
'                       25 Jan 08       2.2                     Now does direct 
bind to retrieve mailNickname (instead of ADSI query)
'///////////////////////////////////////////////////////////////

'Option Explicit
On Error Resume Next

'===============================================================
'Declare variables, instantiate common script objects
'===============================================================

Const ForReading = 1, ForWriting = 2, ForAppending = 8

Dim wsh : Set wsh = CreateObject("WScript.Shell")
Dim wsn : Set wsn = CreateObject("WScript.Network")
Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")

Dim strUserProfile : strUserProfile = 
wsh.ExpandEnvironmentStrings("%USERPROFILE%")
Dim strFlagFile : strFlagFile = strUserProfile & "\ConfigOutlookProfile.flg"
Dim strScriptPath : strScriptPath = 
fso.GetParentFolderName(WScript.ScriptFullName)
Dim strRemoteTemplate : strRemoteTemplate = strScriptPath & "\Template.prf"
Dim strLocalTemplate : strLocalTemplate = strUserProfile & "\Template.prf"
Dim strCustomProfile : strCustomProfile = strUserProfile & "\OutlookProfile.prf"

'===============================================================
'Begin Execution of Script
'===============================================================

If fso.FileExists(strFlagFile) Then WScript.Quit

Dim strAppPath
Dim intOutlookVersion : intOutlookVersion = GetOutlookVersion()

'If Outlook is not found, then quit.
If intOutlookVersion = 0 Then WScript.Quit

'Copy profile template to user's profile and customize user settings.
fso.CopyFile strRemoteTemplate, strLocalTemplate, True
Dim objTemplate : Set objTemplate = fso.OpenTextFile(strLocalTemplate, 
ForReading, False)
Dim strTemplate : strTemplate = objTemplate.ReadAll
objTemplate.Close
Set objTemplate = Nothing

'Get e-mail alias and populate in the profile template.
Dim objUser : Set objUser = GetObject(GetADsPath("user"))
Dim strMailNickname : strMailNickname = objUser.mailNickname
If strMailNickname <> "" Then strTemplate = Replace(strTemplate, "%USERNAME%", 
strMailNickname)

Dim objProfile : Set objProfile = fso.CreateTextFile(strCustomProfile, True)
objProfile.Write strTemplate
objProfile.Close
Set objProfile = Nothing
fso.DeleteFile strLocalTemplate, True

'Import the profile settings according to the version of Outlook found.
Select Case intOutlookVersion
        Case 11,12
                '// ----- Outlook 2003/2007 ----- //
                wsh.Run strAppPath & " /importprf " & Chr(34) & 
strCustomProfile & Chr(34)
        Case 10
                '// ----- Outlook 2002 (XP) ----- //
                wsh.Run Chr(34) & strCustomProfile & Chr(34)
        Case 9
                '// ----- Outlook 2000 ----- //
                If IsDefaultClient() Then
                        wsh.Run strScriptPath & "\modprof.exe -P " & Chr(34) & 
strCustomProfile & Chr(34), 0, True
                        wsh.Run strAppPath
                Else
                        'Microsoft Outlook 2000 was not set as the default mail 
application.
                        MsgBox "Your Outlook profile could not be configured 
because" & VbCrLf & _
                                "Microsoft Outlook is not the default mail 
application." & VbCrLf & VbCrLf & _
                                "Please contact your the Help Desk for 
assistance.", _
                                0 + 16, WScript.ScriptName
                End If
        Case Else
                '// ----- Unknown version found -----
End Select

fso.CreateTextFile strFlagFile, True

'===============================================================
'Clear variables, terminate script
'===============================================================

Set wsh = Nothing
Set wsn = Nothing
Set fso = Nothing

WScript.Quit

'===============================================================
'Declare procedures/functions/classes
'===============================================================

'--------------------
Function IsDefaultClient()
'--------------------
On Error Resume Next
'This is only necessary on Outlook 2000 systems.
If wsh.RegRead("HKLM\SOFTWARE\Clients\Mail\") = "Microsoft Outlook" Then
        IsDefaultClient = True
Else
        IsDefaultClient = False
End If
End Function

'--------------------
Function GetADsPath(strObjType)
'--------------------
'Returns the ADsPath of the current user or computer object.

'Version History
'04 May 2006 - Updated so that forward slashes in the object DN are escaped 
with a preceeding backslash.
'11 May 2006 - Updated so that "LDAP://" precedes the DN that is returned.

On Error Resume Next
Dim objSysInfoTemp : Set objSysInfoTemp = CreateObject("ADSystemInfo")
Select Case LCase(strObjType)
        Case "computer" : GetADsPath = "LDAP://" & 
Replace(objSysInfoTemp.ComputerName, "/", "\/")
        Case "user" : GetADsPath = "LDAP://" & Replace(objSysInfoTemp.UserName, 
"/", "\/")
        Case Else : GetADsPath = Null
End Select
Set objSysInfoTemp = Nothing
End Function

'--------------------
Function GetOutlookVersion()
'--------------------
On Error Resume Next
Dim strAppVersion
strAppPath = wsh.RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App 
Paths\OUTLOOK.EXE\")
If Not Err = 0 Then
        GetOutlookVersion = 0
        Exit Function
End If
strAppVersion = fso.GetFileVersion(strAppPath)
strAppVersion = Split(strAppVersion, ".")
GetOutlookVersion = CInt(strAppVersion(0))
End Function

Other related posts: