Skip to main content

One of my needs when deploying MS Office 2011 via JAMF is to have a method for auto-configuring MS Outlook 2011 when it is run for the first time.

On first run, it prompts the user to confirm that their email address and user name are correct, then it auto-connects to MS Exchange.

This negates the need for the Service Desk technician to configure email (something we've been doing up until now).

I also include a manual method for those one-off moments when you're on a remote call with a user who just "doesn't get it."

Unlike MS Outlook 2010 for Windows, the Mac counterpart is sorely lacking in auto-configuration capabilities.

So I created a special PKG file using Composer.

NOTES FROM MY CASPER ADMIN
Package created with: Casper Composer 9.24
Package created by: Caine Hörr
Package created on: 2014-08-04

Package creates /Users/Shared/Microsoft_Office_2011/

Directory /Users/Shared/Microsoft_Office_2011/ contains the following: - Office_Installer.pkg

Package creates /System/Library/user Template/English.lproj/Documents/Microsoft User Data/ (See NOTE #1)

Package creates /Library/Workday/Outlook Setup Script/

Directory /Library/Workday/Outlook Setup Script/ contains the following: - OutlookExchangeSetup4.0.2_Automatic.scpt (See NOTE #2) - OutlookExchangeSetup4.0.2_Manual.scpt (See NOTE #3)

Microsoft_Office_2011_Plus_Exchange_Setup_v1.0.pkg.zip contains postflight script (See NOTE #4)

NOTE #1
/System/Library/user Template/English.lproj/Documents/Microsoft User Data/ is a clean capture of a non-configured Outlook 2011 session. This is required to set up additional AppleScript features as required (See NOTE #2 and NOTE #3).

NOTE #2
OutlookExchangeSetup4.0.2_Automatic.scpt is automatically run at first launch of Outlook 2011 thereby auto-configuring the end-user's email account without need for Service Desk intervention.

NOTE #3
OutlookExchangeSetup4.0.2_Manual.scpt is a persistent script that is available to both Service Desk and end users in the event that the Outlook user profile needs to be recreated.

NOTE #4
The postflight.sh installs the baseline MS Office 2011 package. The postflight.sh is required to properly install MS Office 2011 via JSS without prompting for MS Office 2011 license key. Because of this particular deployment methodology, MS Office 2011 should not be configured for "Allow package to be uninstalled" by Casper Admin.
[code]
#!/bin/sh
## postflight
##
## Not supported for flat packages.

pathToScript=$0
pathToPackage=$1
targetLocation=$2
targetVolume=$3

# Install Office 2011
installer -verboseR -pkg /Users/Shared/Microsoft_Office_2011/Office_Installer.pkg -target /

# Remove Installation Directory
rm -rf /Users/Shared/Microsoft_Office_2011/

exit 0 ## Success
exit 1 ## Failure
[/code]

GETTING STARTED

First things first - I needed a way in which to accomplish my task. I found this Apple Script...

http://www.officeformachelp.com/outlook/exchange/setup-script/

So I downloaded this script and I salted to taste. If you compare the original script (see link) and compare to my version, I've added some functionality that I needed for my environment.

+I created two copies of the script.

+Script Copy One: OutlookExchangeSetup4.0.2_Automatic.scpt
[code]
(*

--------------------------------------------
Outlook Exchange Setup 4.0.2 - Automatic
© Copyright 2008-2010 William Smith
bill@officeformachelp.com

ACME Corporation Specific Updates added by Caine Hörr
ACME Corporation Specific Updates added on Friday, August 1, 2014
ACME Corporation Specific Updated last updated by Caine Hörr
ACME Corporation Specific Updated last updated on Monday, August 4, 2014

ACME CORPORATION SPECIFIC NOTES:
This is a first run script. This version of the script is configured to
allow for automatic configuration of Microsoft Outlook 2011 within the ACME Corporation environment. Once the script has run, it will no longer be available to the user. For subsequent runs, run the script entitled "Exchange Setup" within Outlook 2011.

Except where otherwise noted, this work is licensed under
http://creativecommons.org/licenses/by/3.0/

This script may be freely modified for personal or commercial
purposes but may not be republished for profit without prior consent.

If you find this script useful or have ideas for improving it,
please let me know. It is only compatible with Outlook for Mac 2011.

--------------------------------------------

This script assists a user with the setup of his Exchange account
information. Below are basic instructions for using the script.
Consult the Outlook Exchange Setup 4.0 Administrator's Guide
for complete details.

  1. Customize the "network and server properties" below with information
    appropriate to your network.

  2. a. Launch Microsoft Outlook under a Mac OS X account that has no Outlook identity. Identities are found in ~/Documents/Microsoft User Data/Office 2011 Identities.

    b. Close the Outlook Setup Assistant window and select Outlook --> Work Offline.

    c. In the Finder, create a folder called "Outlook Setup Script" in /Library/<your company name>/ or any single location where all users have Read permissions.

    d. Copy your customized script to the "Outlook Setup Script" folder. It should be saved as a compiled script, not an application. You can rename the script if you wish.

    e. In Outlook select Tools --> Schedules... and create a New Schedule. Name: Outlook Setup When: At Startup Action: Run AppleScript, choose the saved script in the "Outlook Setup Script" folder. Click the "OK" button. Your script should be set to run at "Next Startup".

    f. Configure any preferences, schedules, signatures, etc. This can include Default address format, Default time zone, fonts, encoding for attachments and more.

    g. Quit Outlook.

    h. Depending on your admin tools, you can push the script to the /Library folder of a new computer and the "~/Documents/Microsoft User Data/Office 2011 Identities/Main Identity" folder and to the "/System/Library/User Template/English.lproj/Documents/Microsoft User Data/ Office 2011 Identities" folder.

    New users on a machine will have the pre-configured Main Identity folder copied to their home folders the first time they log in to a computer.

    The first time they launch Outlook, the "Exchange Setup" schedule will run the script.

    The script will disable the Schedule once it has run and will set Outlook to work online.

This script assumes the user's full name is in the form of "Last, First",
but is easily modified if the full name is in the form of "First Last".
It works especially well if the Mac is bound to Active Directory where
the user's short name will match his login name. Optionally, a dscl command
can be used to pull the user's EMailAddress from a directory service.

*)

--------------------------------------------
-- Begin network and server properties
--------------------------------------------

property useKerberos : false
-- Set this property to true only if Macs in your environment
-- are bound to Active Directory.
-- Kerberos support works only if your network is properly
-- configured.

property kerberosRealm : "example.com"
-- For most Kerberos environments the Kerberos realm
-- will be the same as the E-mail domain name.
-- This property is used only if the userKerberos property above
-- is true.

property domainName : "ACMECorporation.com"
-- example: "domain.com"

property InternalDomainName : "ACMECorporationInternal.com"
-- example: "internaldomain.com"

property ExchangeServer : "https://outlook.office365.com/EWS/Exchange.asmx"
-- example: "ExchangeServer.domain.com"

property ExtendedExchangeServerAddress : false
-- Are you connecting to an Exchange Server 2007 server?
-- If so, you may need to use the extended address:
-- "ExchangeServer.domain.com/exchange/user@example.com".
-- Set this to "true" if you need the extended address.

property ExchangeServerRequiresSSL : true
-- If Exchange users will connect to a backend server
-- within the same network then SSL is probably not required.
-- OWA connections will probably require SSL and
-- this setting should be set to true.

property ExchangeServerSSLPort : 443
-- If ExchangeServerSSL is false set the port to 80.
-- If ExchangeServerSSL is true set the port to 443.
-- Use a different port number only if specified
-- by your administrator.

property DirectoryServer : "gc.example.com"
-- example: "GlobalCatalogServer.domain.com"

-- OWA connections cannot use the OWA address.

property DirectoryServerRequiresAuthentication : true
-- This will almost always be true. The LDAP server
-- in a Windows network will be a Global Catalog server,
-- which is separate from the Exchange Server.
-- OWA connections can not use the OWA address
-- with this setting.

property DirectoryServerRequiresSSL : false
-- If Exchange users will connect to a backend server
-- within the same network then SSL is probably
-- not required. OWA connections can not use
-- the OWA address with this setting.

property DirectoryServerSSLPort : 3268
-- If DirectoryServerRequiresSSL is false set the port to 3268.
-- If DirectoryServerRequiresSSL is true set the port to 3269.
-- Use a different port number only if specified
-- by your administrator.

-- OWA connections cannot use the OWA address with this setting.

property DirectoryServerMaximumResults : 1000
-- When searching the Global Address list, this number determines
-- the maximum number of entries to display.

property DirectoryServerSearchBase : ""
-- example: "cn=users,dc=domain,dc=com"

-- Search base will be optional in many environments and its
-- format will vary greatly. Experiment first connecting without
-- entering the search base information.

property getEMailAddressUsingDSCL : false
-- If the Macs are connected to a directory service such as
-- Active Directory, then they can probably use dscl to return
-- the current user's E-mail address instead of trying to parse it
-- from the display name.

-- Using dscl is preferred. Otherwise, set this to false
-- and set the next property to the appropriate number.

property emailFormat : 1
-- When dscl is unavailable to determine a user's E-mail address,
-- it can be parsed using the display name of the user's login.
-- Set the next two properties to the examples
-- that correspond to your organization's setup.

-- 1: E-mail format is first.last@domain.com
-- 2: E-mail format is first@domain.com
-- 3: E-mail format is flast@domain.com (first name initial plus last name)
-- 4: E-mail format is shortName@domain.com

property displayName : 2
-- 1: Display name displays as "Last, First"
-- 2: Display name displays as "First Last"

property verifyEMailAddress : true
-- If set to "true", a dialog will ask the user to confirm
-- his E-mail address.

property verifyFQUN : true
-- If set to "true", a dialog will ask the user to confirm
-- his Fully Qualified Username.

property verifyServerAddress : false
-- If set to "true", a dialog will ask the user to confirm
-- his Exchange server address.

property ExchangeAutoDiscover : false
-- If set to "false", Exchange Autodiscover will be disabled

property scheduled : false
-- Exchange accounts don't require that
-- the "Send & Receive All" schedule be enabled.
-- Change this setting to true if the user
-- will also be connecting to POP or IMAP accounts.

property errorMessage : "Setup of your ACME Corporation email account has failed. Please contact the ACME Corporation Service Desk for assistance."
-- Customize this error message for your users
-- if their account setup fails

--------------------------------------------
-- End server properties
--------------------------------------------

--------------------------------------------
-- Begin get user name
--------------------------------------------

-- User information is pulled from the account settings of the current user account

tell application "System Events" set shortName to name of current user set fullName to full name of current user
end tell

--------------------------------------------
-- End get user name
--------------------------------------------

----------------------------------------------
-- Begin Set Fully Qualified User name (FQUN)
----------------------------------------------

set FQUN to shortName & "@" & InternalDomainName

----------------------------------------------
-- End Set Fully Qualified User Name (FQUN)
----------------------------------------------

--------------------------------------------
-- Begin email address properties
--------------------------------------------

if getEMailAddressUsingDSCL is true then set emailAddress to do shell script "dscl . -read /Users/" & shortName & " EMailAddress | awk 'BEGIN {FS=": "} {print $2}'"

else if emailFormat is 1 and displayName is 1 then

-- first.last@domain.com and full name displays as "Last, First"

set AppleScript's text item delimiters to ", " set firstName to text item 2 of fullName set lastName to text item 1 of fullName set AppleScript's text item delimiters to "" set emailAddress to firstName & "." & lastName & "@" & domainName

else if emailFormat is 1 and displayName is 2 then

-- first.last@domain.com and full name displays as "First Last"

set AppleScript's text item delimiters to " " set firstName to text item 1 of fullName set lastName to text item 2 of fullName set AppleScript's text item delimiters to "" set emailAddress to firstName & "." & lastName & "@" & domainName

else if emailFormat is 2 and displayName is 1 then

-- first@domain.com and full name displays as "Last, First"

set AppleScript's text item delimiters to ", " set firstName to text item 2 of fullName set lastName to text item 1 of fullName set AppleScript's text item delimiters to "" set emailAddress to firstName & "@" & domainName

else if emailFormat is 2 and displayName is 2 then

-- first@domain.com if full name displays as "First Last"

set AppleScript's text item delimiters to " " set firstName to text item 1 of fullName set lastName to text item 2 of fullName set AppleScript's text item delimiters to "" set emailAddress to firstName & "@" & domainName

else if emailFormat is 3 and displayName is 1 then

-- flast@domain.com and full name displays as "Last, First"

set AppleScript's text item delimiters to ", " set firstName to text item 2 of fullName set lastName to text item 1 of fullName set AppleScript's text item delimiters to "" set emailAddress to (character 1 of firstName) & lastName & "@" & domainName

else if emailFormat is 3 and displayName is 2 then

-- flast@domain.com and full name displays as "First Last"

set AppleScript's text item delimiters to " " set firstName to text item 1 of fullName set lastName to text item 2 of fullName set AppleScript's text item delimiters to "" set emailAddress to (character 1 of firstName & lastName & "@" & domainName)

else if emailFormat is 4 and displayName is 1 then

-- shortName@domain.com and full name displays as "Last, First"

set AppleScript's text item delimiters to ", " set firstName to text item 2 of fullName set lastName to text item 1 of fullName set AppleScript's text item delimiters to "" set emailAddress to shortName & "@" & domainName

else if emailFormat is 4 and displayName is 2 then

-- shortName@domain.com and full name displays as "First Last"

set AppleScript's text item delimiters to " " set firstName to text item 1 of fullName set lastName to text item 2 of fullName set AppleScript's text item delimiters to "" set emailAddress to shortName & "@" & domainName

end if

--------------------------------------------
-- End email address properties
--------------------------------------------

--------------------------------------------
-- Exchange Server 2007 extended address
--------------------------------------------

if ExtendedExchangeServerAddress is true then set ExchangeServer to ExchangeServer & "/exchange/" & emailAddress
end if

--------------------------------------------
-- End get user name
--------------------------------------------

--------------------------------------------
-- Begin account setup
--------------------------------------------

try

if verifyEMailAddress is true then set verifyEmail to display dialog "Please verify that your email address is correct." default answer emailAddress with icon 2 buttons {"Cancel", "OK"} default button {"OK"} set emailAddress to text returned of verifyEmail end if

if verifyFQUN is true then set verifyFQUN to display dialog "Please verify that your Fully Qualified Username is correct." default answer FQUN with icon 2 buttons {"Cancel", "OK"} default button {"OK"} set FQUN to text returned of verifyFQUN end if

if verifyServerAddress is true then set verifyServer to display dialog "Please verify that your Exchange Server name is correct." default answer ExchangeServer with icon 2 buttons {"Cancel", "OK"} default button {"OK"} set ExchangeServer to text returned of verifyServer end if

tell application "Microsoft Outlook" activate

set working offline to true

set newExchangeAccount to make new exchange account with properties ¬ {name:"Mailbox - " & fullName, user name:FQUN, full name:fullName, email address:emailAddress, server:ExchangeServer, use ssl:ExchangeServerRequiresSSL, port:ExchangeServerSSLPort, ldap server:DirectoryServer, ldap needs authentication:DirectoryServerRequiresAuthentication, ldap use ssl:DirectoryServerRequiresSSL, ldap max entries:DirectoryServerMaximumResults, ldap search base:DirectoryServerSearchBase}

-- The following lines enable Kerberos support if the userKerberos property above is set to true.

if useKerberos is true then set use kerberos authentication of newExchangeAccount to useKerberos set principal of newExchangeAccount to shortName & "@" & kerberosRealm end if

-- The Me Contact record is now automatically created with the first account. -- Set the first and last name of the Me Contact record.

set first name of me contact to firstName set last name of me contact to lastName set email addresses of me contact to {address:emailAddress, type:work}

-- We're done. Set the schedules back to normal and set Outlook to work online

set enabled of schedule "Send & Receive All" to scheduled

delete schedule "Exchange Setup First Run"

set working offline to false

-------------------------------------------- -- Disable Autodiscover -------------------------------------------- if ExchangeAutoDiscover is false then tell application "Microsoft Outlook" set background autodiscover of exchange account 1 to false end tell end if

end tell

on error

display dialog errorMessage with icon 2 buttons {"OK"} default button {"OK"}

end try

--------------------------------------------
-- End account setup
--------------------------------------------
[/code]

Script Copy Two: OutlookExchangeSetup4.0.2_Manual.scpt
[code]
(*

--------------------------------------------
Outlook Exchange Setup 4.0.2 - Manual
© Copyright 2008-2010 William Smith
bill@officeformachelp.com

ACME Corporation Specific Updates added by Caine Hörr
ACME Corporation Specific Updates added on Friday, August 1, 2014
ACME Corporation Specific Updated last updated by Caine Hörr
ACME Corporation Specific Updated last updated on Monday, August 4, 2014

ACME CORPORATION SPECIFIC NOTES:
This is a first run script. This version of the script is configured to
allow for manually invoked automatic configuration of Microsoft Outlook 2011 within the ACME Corporation environment. This script is available to be run multiple times
as needed from within Outlook 2011. For subsequent runs, run the script entitled "Exchange Setup - Manual" within Outlook.

Except where otherwise noted, this work is licensed under
http://creativecommons.org/licenses/by/3.0/

This script may be freely modified for personal or commercial
purposes but may not be republished for profit without prior consent.

If you find this script useful or have ideas for improving it,
please let me know. It is only compatible with Outlook for Mac 2011.

--------------------------------------------

This script assists a user with the setup of his Exchange account
information. Below are basic instructions for using the script.
Consult the Outlook Exchange Setup 4.0 Administrator's Guide
for complete details.

  1. Customize the "network and server properties" below with information
    appropriate to your network.

  2. a. Launch Microsoft Outlook under a Mac OS X account that has no Outlook identity. Identities are found in ~/Documents/Microsoft User Data/Office 2011 Identities.

    b. Close the Outlook Setup Assistant window and select Outlook --> Work Offline.

    c. In the Finder, create a folder called "Outlook Setup Script" in /Library/<your company name>/ or any single location where all users have Read permissions.

    d. Copy your customized script to the "Outlook Setup Script" folder. It should be saved as a compiled script, not an application. You can rename the script if you wish.

    e. In Outlook select Tools --> Schedules... and create a New Schedule. Name: Outlook Setup When: At Startup Action: Run AppleScript, choose the saved script in the "Outlook Setup Script" folder. Click the "OK" button. Your script should be set to run at "Next Startup".

    f. Configure any preferences, schedules, signatures, etc. This can include Default address format, Default time zone, fonts, encoding for attachments and more.

    g. Quit Outlook.

    h. Depending on your admin tools, you can push the script to the /Library folder of a new computer and the "~/Documents/Microsoft User Data/Office 2011 Identities/Main Identity" folder and to the "/System/Library/User Template/English.lproj/Documents/Microsoft User Data/ Office 2011 Identities" folder.

    New users on a machine will have the pre-configured Main Identity folder copied to their home folders the first time they log in to a computer.

    The first time they launch Outlook, the "Exchange Setup" schedule will run the script.

    The script will disable the Schedule once it has run and will set Outlook to work online.

This script assumes the user's full name is in the form of "Last, First",
but is easily modified if the full name is in the form of "First Last".
It works especially well if the Mac is bound to Active Directory where
the user's short name will match his login name. Optionally, a dscl command
can be used to pull the user's EMailAddress from a directory service.

*)

--------------------------------------------
-- Begin network and server properties
--------------------------------------------

property useKerberos : false
-- Set this property to true only if Macs in your environment
-- are bound to Active Directory.
-- Kerberos support works only if your network is properly
-- configured.

property kerberosRealm : "example.com"
-- For most Kerberos environments the Kerberos realm
-- will be the same as the E-mail domain name.
-- This property is used only if the userKerberos property above
-- is true.

property domainName : "ACMECorporation .com"
-- example: "domain.com"

property InternalDomainName : "ACMECorporationInternal.com"
-- example: "internaldomain.com"

property ExchangeServer : "https://outlook.office365.com/EWS/Exchange.asmx"
-- example: "ExchangeServer.domain.com"

property ExtendedExchangeServerAddress : false
-- Are you connecting to an Exchange Server 2007 server?
-- If so, you may need to use the extended address:
-- "ExchangeServer.domain.com/exchange/user@example.com".
-- Set this to "true" if you need the extended address.

property ExchangeServerRequiresSSL : true
-- If Exchange users will connect to a backend server
-- within the same network then SSL is probably not required.
-- OWA connections will probably require SSL and
-- this setting should be set to true.

property ExchangeServerSSLPort : 443
-- If ExchangeServerSSL is false set the port to 80.
-- If ExchangeServerSSL is true set the port to 443.
-- Use a different port number only if specified
-- by your administrator.

property DirectoryServer : "gc.example.com"
-- example: "GlobalCatalogServer.domain.com"

-- OWA connections cannot use the OWA address.

property DirectoryServerRequiresAuthentication : true
-- This will almost always be true. The LDAP server
-- in a Windows network will be a Global Catalog server,
-- which is separate from the Exchange Server.
-- OWA connections can not use the OWA address
-- with this setting.

property DirectoryServerRequiresSSL : false
-- If Exchange users will connect to a backend server
-- within the same network then SSL is probably
-- not required. OWA connections can not use
-- the OWA address with this setting.

property DirectoryServerSSLPort : 3268
-- If DirectoryServerRequiresSSL is false set the port to 3268.
-- If DirectoryServerRequiresSSL is true set the port to 3269.
-- Use a different port number only if specified
-- by your administrator.

-- OWA connections cannot use the OWA address with this setting.

property DirectoryServerMaximumResults : 1000
-- When searching the Global Address list, this number determines
-- the maximum number of entries to display.

property DirectoryServerSearchBase : ""
-- example: "cn=users,dc=domain,dc=com"

-- Search base will be optional in many environments and its
-- format will vary greatly. Experiment first connecting without
-- entering the search base information.

property getEMailAddressUsingDSCL : false
-- If the Macs are connected to a directory service such as
-- Active Directory, then they can probably use dscl to return
-- the current user's E-mail address instead of trying to parse it
-- from the display name.

-- Using dscl is preferred. Otherwise, set this to false
-- and set the next property to the appropriate number.

property emailFormat : 1
-- When dscl is unavailable to determine a user's E-mail address,
-- it can be parsed using the display name of the user's login.
-- Set the next two properties to the examples
-- that correspond to your organization's setup.

-- 1: E-mail format is first.last@domain.com
-- 2: E-mail format is first@domain.com
-- 3: E-mail format is flast@domain.com (first name initial plus last name)
-- 4: E-mail format is shortName@domain.com

property displayName : 2
-- 1: Display name displays as "Last, First"
-- 2: Display name displays as "First Last"

property verifyEMailAddress : true
-- If set to "true", a dialog will ask the user to confirm
-- his E-mail address.

property verifyFQUN : true
-- If set to "true", a dialog will ask the user to confirm
-- his Fully Qualified Username.

property verifyServerAddress : true
-- If set to "true", a dialog will ask the user to confirm
-- his Exchange server address.

property ExchangeAutoDiscover : false
-- If set to "false", Exchange Autodiscover will be disabled

property scheduled : false
-- Exchange accounts don't require that
-- the "Send & Receive All" schedule be enabled.
-- Change this setting to true if the user
-- will also be connecting to POP or IMAP accounts.

property errorMessage : "Setup of your ACME Corporation email account has failed. Please contact the ACME Corporation Service Desk for assistance."
-- Customize this error message for your users
-- if their account setup fails

--------------------------------------------
-- End server properties
--------------------------------------------

--------------------------------------------
-- Begin get user name
--------------------------------------------

-- User information is pulled from the account settings of the current user account

tell application "System Events" set shortName to name of current user set fullName to full name of current user
end tell

--------------------------------------------
-- End get user name
--------------------------------------------

----------------------------------------------
-- Begin Set Fully Qualified Usern name (FQUN)
----------------------------------------------

set FQUN to shortName & "@" & InternalDomainName

----------------------------------------------
-- End Set Fully Qualified User Name (FQUN)
----------------------------------------------

--------------------------------------------
-- Begin email address properties
--------------------------------------------

if getEMailAddressUsingDSCL is true then set emailAddress to do shell script "dscl . -read /Users/" & shortName & " EMailAddress | awk 'BEGIN {FS=": "} {print $2}'"

else if emailFormat is 1 and displayName is 1 then

-- first.last@domain.com and full name displays as "Last, First"

set AppleScript's text item delimiters to ", " set firstName to text item 2 of fullName set lastName to text item 1 of fullName set AppleScript's text item delimiters to "" set emailAddress to firstName & "." & lastName & "@" & domainName

else if emailFormat is 1 and displayName is 2 then

-- first.last@domain.com and full name displays as "First Last"

set AppleScript's text item delimiters to " " set firstName to text item 1 of fullName set lastName to text item 2 of fullName set AppleScript's text item delimiters to "" set emailAddress to firstName & "." & lastName & "@" & domainName

else if emailFormat is 2 and displayName is 1 then

-- first@domain.com and full name displays as "Last, First"

set AppleScript's text item delimiters to ", " set firstName to text item 2 of fullName set lastName to text item 1 of fullName set AppleScript's text item delimiters to "" set emailAddress to firstName & "@" & domainName

else if emailFormat is 2 and displayName is 2 then

-- first@domain.com if full name displays as "First Last"

set AppleScript's text item delimiters to " " set firstName to text item 1 of fullName set lastName to text item 2 of fullName set AppleScript's text item delimiters to "" set emailAddress to firstName & "@" & domainName

else if emailFormat is 3 and displayName is 1 then

-- flast@domain.com and full name displays as "Last, First"

set AppleScript's text item delimiters to ", " set firstName to text item 2 of fullName set lastName to text item 1 of fullName set AppleScript's text item delimiters to "" set emailAddress to (character 1 of firstName) & lastName & "@" & domainName

else if emailFormat is 3 and displayName is 2 then

-- flast@domain.com and full name displays as "First Last"

set AppleScript's text item delimiters to " " set firstName to text item 1 of fullName set lastName to text item 2 of fullName set AppleScript's text item delimiters to "" set emailAddress to (character 1 of firstName & lastName & "@" & domainName)

else if emailFormat is 4 and displayName is 1 then

-- shortName@domain.com and full name displays as "Last, First"

set AppleScript's text item delimiters to ", " set firstName to text item 2 of fullName set lastName to text item 1 of fullName set AppleScript's text item delimiters to "" set emailAddress to shortName & "@" & domainName

else if emailFormat is 4 and displayName is 2 then

-- shortName@domain.com and full name displays as "First Last"

set AppleScript's text item delimiters to " " set firstName to text item 1 of fullName set lastName to text item 2 of fullName set AppleScript's text item delimiters to "" set emailAddress to shortName & "@" & domainName

end if

--------------------------------------------
-- End email address properties
--------------------------------------------

--------------------------------------------
-- Exchange Server 2007 extended address
--------------------------------------------

if ExtendedExchangeServerAddress is true then set ExchangeServer to ExchangeServer & "/exchange/" & emailAddress
end if

--------------------------------------------
-- End get user name
--------------------------------------------

--------------------------------------------
-- Begin account setup
--------------------------------------------

try

if verifyEMailAddress is true then set verifyEmail to display dialog "Please verify that your email address is correct." default answer emailAddress with icon 2 buttons {"Cancel", "OK"} default button {"OK"} set emailAddress to text returned of verifyEmail end if

if verifyFQUN is true then set verifyFQUN to display dialog "Please verify that your Fully Qualified Username is correct." default answer FQUN with icon 2 buttons {"Cancel", "OK"} default button {"OK"} set FQUN to text returned of verifyFQUN end if

if verifyServerAddress is true then set verifyServer to display dialog "Please verify that your Exchange Server name is correct." default answer ExchangeServer with icon 2 buttons {"Cancel", "OK"} default button {"OK"} set ExchangeServer to text returned of verifyServer end if

tell application "Microsoft Outlook" activate

set working offline to true

(*
-------------------------------------------- set newExchangeAccount to make new exchange account with properties ¬ {name:"Mailbox - " & fullName, user name:shortName, full name:fullName, email address:emailAddress, server:ExchangeServer, use ssl:ExchangeServerRequiresSSL, port:ExchangeServerSSLPort, ldap server:DirectoryServer, ldap needs authentication:DirectoryServerRequiresAuthentication, ldap use ssl:DirectoryServerRequiresSSL, ldap max entries:DirectoryServerMaximumResults, ldap search base:DirectoryServerSearchBase}
--------------------------------------------
*)

set newExchangeAccount to make new exchange account with properties ¬ {name:"Mailbox - " & fullName, user name:FQUN, full name:fullName, email address:emailAddress, server:ExchangeServer, use ssl:ExchangeServerRequiresSSL, port:ExchangeServerSSLPort, ldap server:DirectoryServer, ldap needs authentication:DirectoryServerRequiresAuthentication, ldap use ssl:DirectoryServerRequiresSSL, ldap max entries:DirectoryServerMaximumResults, ldap search base:DirectoryServerSearchBase}

-- The following lines enable Kerberos support if the userKerberos property above is set to true.

if useKerberos is true then set use kerberos authentication of newExchangeAccount to useKerberos set principal of newExchangeAccount to shortName & "@" & kerberosRealm end if

-- The Me Contact record is now automatically created with the first account. -- Set the first and last name of the Me Contact record.

set first name of me contact to firstName set last name of me contact to lastName set email addresses of me contact to {address:emailAddress, type:work}

-- We're done. Set the schedules back to normal and set Outlook to work online

set enabled of schedule "Send & Receive All" to scheduled

-- delete schedule "Exchange Setup First Run"

set working offline to false

-------------------------------------------- -- Disable Autodiscover -------------------------------------------- if ExchangeAutoDiscover is false then tell application "Microsoft Outlook" set background autodiscover of exchange account 1 to false end tell end if

end tell

on error

display dialog errorMessage with icon 2 buttons {"OK"} default button {"OK"}

end try

--------------------------------------------
-- End account setup
--------------------------------------------
[/code]

Using Composer, I created a PKG file I called Microsoft_Office_2011_Plus_Exchange_Setup_v1.0.pkg

Here's what I did...

  1. Created /Library/Workday/Outlook Setup Script/
  2. Copied both scripts into /Library/Workday/Outlook Setup Script/
  3. Installed MS Office 2011
  4. Launched Outlook 2011 once finished
  5. Answer screens regarding automatic updates and the like. Blah blah blah.
  6. Canceled out of email configuration screen
  7. Clicked on Tools
  8. Clicked on Run Schedule
  9. Clicked on Edit Schedules...
  10. Created a new schedule
  11. Pointed to the OutlookExchangeSetup4.0.2_Automatic.scpt per the instructions within the script
  12. Set to run on first launch
  13. Saved the schedule
  14. Created a new schedule
  15. Pointed to the OutlookExchangeSetup4.0.2_Manual.scpt per the instructions within the script
  16. Saved the schedule
  17. Exited Outlook 2011
  18. Moved ~/Documents/Microsoft User Data into /System/Library/user Template/English.lproj/Documents/Microsoft User Data/
  19. Ran Composer
  20. Set to Normal Snapshot
  21. Created /Users/Shared/Microsoft_Office_2011/
  22. Placed a copy of Office_Installer.pkg in /Users/Shared/Microsoft_Office_2011/
  23. Edited PKG to include /Library/Workday/Outlook Setup Script/
  24. Edited PKG to include /System/Library/user Template/English.lproj/Documents/Microsoft User Data/
  25. Edited PKG to have a postflight.sh script (see above)
  26. Saved as PKG
  27. Uploaded to Distribution Point via Capser Admin
  28. Set to Install on boot drive after imaging
  29. Index the PKG

Once the PKG is deployed, nothing further needs to be done.

The user, upon first run of Outlook 2011 will follow the prompts and voila, instant email.

Be the first to reply!