Deploying Office 2011 using Casper can range from “Simple” to “Complex”. Each of the three methods described below has its advantages and disadvantages and no one method is ideal for everyone. The following table provides an overview:
|Drag & Drop||Snapshot||Scripted|
|Pros||• Takes no preparation
• Easy to update
• Easy to uninstall
|• Highly customizable
• Uses least disk space
• Easy to update
|Cons||• Not customizable
• Uses more disk space
• Requires manual uninstall
|• Takes longer to prepare
• Must be redone for each Office update
• Uses most disk space
|• Takes longer to prepare
• Requires some scripting knowledge
• Requires manual uninstall
|Ideal||• Disk space and network bandwidth are of some concern
• Novice Casper administrator
|• Disk space and network bandwidth are not a concern
• Junior Casper administrator
|• Disk space and network bandwidth are a concern
• Experienced Casper administrator
Drag & Drop is on the “Simple” end of the scale because it’s the quickest and easiest means of preparing Office for Mac for deployment with Casper. It does not offer, however, any means to uninstall the software nor to select what gets installed.
The Snapshot method requires using the Composer application from JAMF Software. Composer will watch what happens during a software installation and compile a list of files that have been added or modified. The files are collected and packaged for deployment. While snapshotting makes un-installing easier and allows an administrator to customize the deployment package, it requires multiple packages to deploy multiple customized versions of Office for Mac.
A Scripted install is the most complex to create upfront but offers great flexibility in what gets installed as well as uses the least amount of disk space. Maintaining the files for this type of install is much easier than maintaining Snapshot files but this method also does not offer any means to uninstall the software.
Drag & Drop
Microsoft ships Office for Mac 2008 and 2011 as Apple Installer packages. When imaging a machine or deploying software, Casper will call the command line version of the Apple Installer to install the Microsoft Office software. Therefore, the packages only need to be added to the JAMF Software Server (JSS) using Casper Admin’s drag & drop feature.
- Launch Casper Admin and log into the JSS.
- Drag the Office Installer.mpkg file into the Casper Admin window to begin the upload process.
- Once the file has uploaded, double-click it in the Casper Admin window to view its Info tab. Assign the package to a category and adjust the Display Name or File Name if needed.
- Click the Options tab and assign the package a priority. Microsoft Office does not require a reboot but Microsoft Office 2011 does require an Intel processor. Click the OK button to save the settings.
- Microsoft also releases its Office for Mac updates in the Apple Installer package format and these can be dropped into Casper Admin too. They should be assigned a lower priority (higher number) so that they are installed after the Office applications get installed.
Taking a snapshot using Composer is a fairly straight-forward process but it also requires some familiarity with the Mac OS itself. A snapshot makes a list of files before software is installed, compares it to a second list of files that it makes after software is installed and then packages the new files for deployment. Processes unrelated to the installation can introduce extraneous files that should be culled before making the final package. Knowing what should remain and what should be deleted can be tricky sometimes.
- Launch Composer and enter a local administrator’s name and password when prompted.
- Click the New Package icon in the toolbar. When the New Package window appears, select the option to take a Normal Snapshot. This will look for changed files only. Using the Monitor File System Changes option is unreliable for snapshotting a Microsoft Office installation and may miss some components. Click the Choose… button to continue.
- Enter a name for the new package. It can be changed later. Click the Begin button.
This will begin the process of taking the first snapshot.
- At this point, do a little as possible other than installing Microsoft Office and any updates. Avoid opening and closing windows, connecting to servers, opening files or anything that may create a new permanent or temporary file.
Install Microsoft Office and then install any additional updates.
Allow Composer to sit quietly in the background. When all the software is installed then click the Build Package button to take the second snapshot and collect the new files.
- Once Composer has collected the newly installed files, extraneous files may need removing. The final list should be similar to the Installed files list for Office 2011.
Files for Microsoft Office should inherit the owner, group and permissions of their parent folders.
- Click the Build as DMG button to create the new package and then add the package to the JSS using Casper Admin, similar to adding an Apple Installer package directly.
Scripting is not difficult and requires using only a few basic commands. The result, however, is a highly customized space-saving solution that supports the needs of multiple users.
A scripted install has two parts:
- Apple Installer package: In this case, the Microsoft provided Apple Installer package file “Office Installer.mpkg” gets copied to a system but not installed. It just sits there waiting for a script to call it.
- A script and a choices.xml files: The script does most of the work. It installs Microsoft Office using the choices.xml file to tell the Apple Installer what gets installed and what doesn’t.
The basic command
The script will start with one basic command:
installer -pkg "/path/to/Office Installer.mpkg" -target /
This command invokes “installer”, which is the command line version of the Apple Installer application. It contains three parts:
the name of the application the script runs
-pkg "/path/to/Office Installer.mpkg"
tells installer to run the Apple Installer package (-pkg) called “Office Installer.mpkg” and also tells it where to find the package.
tells where the installer should install the files. In this case the forward slash indicates the root of the current hard drive.
Adding a choices.xml file
A choices.xml file extends this basic command (this should be one line with a space before the -applyChoiceChangesXML argument):
installer -pkg "/path/to/Office Installer.mpkg" -target /
This additional command tells the command line installer application to install Microsoft Office using information from a file called “choices.xml”. The name of the XML file is not important.
What’s in this choices.xml file?
Simply put: a list of things to click. A choices file contains a list of optional items. The optional items in this list correspond to the optional items seen during a custom install using the GUI version of the Apple Installer.
To view a list of choices available in the Office Installer.mpkg file, the command is (one line):
installer -package "/path/to/Office Installer.mpkg"
-showChoicesXML | grep -A 1 choiceIdentifier
When an item is included in a choices file, that is the equivalent of “clicking” the same item in the GUI version of the Apple Installer. By default everything in the Microsoft Office installer is selected. Clicking an item once will de-select it. Clicking it twice will de-select and then select it.
For example: If “Fonts” and “Dock Icons” are listed once in the choices file then they will be “clicked” once and deselected. The choices.xml file would contain:
<array> <string>fonts</string> <string>dock</string> </array>
Alternately, the GUI Installer would display “Office Fonts” and “Dock Icons” as deselected.
Likewise, to install only the English proofing tools and none of the other languages, the “Proofing Tools” option would be the first item in the choices.xml file. Remember, an item in the choices.xml file “clicks” something, it doesn’t “select” it. Therefore, “clicking” the “Proofing Tools” option de-selects it and everything beneath it.
<array> <string>proofing-tools</string> </array>
Then the “English” proofing tools option would follow and this would “click” and “select” the English proofing tools.
<array> <string>proofing-tools</string> <string>english</string> </array>
Readying for deployment
Again, deployment consists of two parts, which are just packages. The first package copies (doesn’t install) the Office Installer.mpkg file to the computer. The second package carries the script to install the software and to deploy any additional files.
Creating the first package is straight-forward.
- Launch Composer and create a folder structure leading to
/private/tmp. This location is ideal for deploying temporary files because Mac OS X will delete everything automatically the next time the computer is restarted.
- Zip the Office Installer.mpkg file and put it into the
/private/tmpfolder in Composer. Compressing is not required but if Composer ever transitions to creating flat packages then it may not properly package the non-flat Office Installer.mpkg file.
- Name the new package and click the Build as DMG button to create a .dmg file.
- Add this new package to the JSS using Casper Admin.
- This package can be deployed normally during imaging time.
This package will be deployed to all computers needing Microsoft Office. Note that it contains practically no customization at this point. That comes next.
Creating the second package involves a little more work.
- Launch Composer and create the
/private/tmpfolder structure again.
- Create the choices.xml file using TextEdit, BBEdit or any text editor that supports plain text and add this file to the
/private/tmpfolder in Composer.
- At this point, rename the package in the SOURCES list to something identifiable such as “Office 2011 Preferences”.
- Next, twiddle open the disclosure triangle next to “Office 2011 Preferences”. Right-click Scripts and select Add Shell Script –> postflight. This script will run automatically after the installer application has copied its files (in this case the choices.xml file plus any others) to
- By default, a few lines of code are pre-populated in the postflight script. Delete everything except the first line. This line is called the “shebang” and tells the UNIX underpinnings of Mac OS X to run the file as a shell script.
- The new postflight script will contain a few instructions. The first instruction changes the working directory to
/private/tmp. All other commands will do the work here.
- The second command unzips the Office Installer.mpkg.zip package deployed by the first package.
unzip "Office Installer.mpkg.zip"
- The third command runs the installer script using the choices.xml file. Note that the path to the installer and the choices.xml file refers to
installer -pkg “/private/tmp/Office Installer.mpkg” -target /
- The final line exits the script with “success!” whether or not everything worked correctly or not. This allows anything that may run after the script to run regardless of previous successes or failures.
These five lines of code are the gist of the entire script.
Anyone familiar with scripting will probably want to add some additional code for logging and troubleshooting purposes. For example, the following reports either a success or failure for unzipping and installing and records a time-stamped event in a log file called “Microsoft Office.log”, which can be read using the Console application found in
/Applications/Utilities. (The backslashes at the end of a few lines simply breaks a long line into shorter lines.)
#!/bin/sh cd /private/tmp unzip "Office Installer.mpkg.zip" if (test $? = 0) then date '+%A %m/%d/%Y %H:%M:%S Microsoft Office was unzipped successfully.' \ >> '/var/log/Casper Logs/Microsoft Office.log' else date '+%A %m/%d/%Y %H:%M:%S Microsoft Office failed to unzip.' >> \ '/var/log/Casper Logs/Microsoft Office.log' fi installer -pkg "/private/tmp/Office Installer.mpkg" \ -target / -applyChoiceChangesXML /private/tmp/choices.xml if (test $? = 0) then date '+%A %m/%d/%Y %H:%M:%S Microsoft Office was installed successfully.' \ >> '/var/log/Casper Logs/Microsoft Office.log' else date '+%A %m/%d/%Y %H:%M:%S Microsoft Office failed to install.' >> \ '/var/log/Casper Logs/Microsoft Office.log' fi exit 0
After saving the script, the “Office 2011 Preferences” package is ready to package. This is a perfect time to include any additional files, such as those for the Outlook Exchange Setup script.
Click the Build as PKG button to save the new package as an Apple Installer package. A .dmg package will not preserve the shell script. Follow the previous Drag & Drop instructions to add the new .dmg package to Casper Admin.
The “Office 2011 Preferences” package should also have the option “This package must be installed to the boot volume at imaging time” enabled in its Information window in Casper Admin so that it installs after the first reboot during imaging. Doing so ensures the script will run correctly.
Make as many “Office 2011 Preferences” packages as needed to customize installations for various groups within an organization. Each should only consume a few KB of space.