Run arbitrary commands with installations of Office 2010
Published: May 16, 2012
If you want to run an arbitrary command or lightweight feature during Setup, use the Microsoft Office 2010 Setup chaining feature.
By default, the Setup program for Office 2010 installs one Office product at a time. To add an arbitrary command or a lightweight executable, you can use the Add installations and run programs feature in the Office Customization Tool (OCT) or the Command element in the Config.xml file. We recommend that you limit the use of Add installations and run programs and the Command element to running only lightweight executables or arbitrary commands that will not make changes to the computer or that do not require user input. For example, you can run a utility to copy logs or a command to launch a Welcome page at the end of installation.
The Add installations and run programs option in the OCT (command lines entered in the Add Program Entry and Modify Program Entry dialog boxes) and the Command element in the Config.xml file are intended to be used only for initial product installations and uninstallations. The commands are processed only during initial installations and uninstallations.
Chaining is not as reliable as installing each product separately. For example, if you chain two installations together and one of the products fails or encounters an unexpected error, the primary installation and the chained installation might not finish successfully. Therefore, we do not recommend using the chaining approach. The recommended method for installing multiple products together is to use a deployment management program, such as Microsoft Systems Management Server or Microsoft System Center Configuration Manager 2007, or a third-party tool, instead of chaining.
In the following example, the OCT is used to add an arbitrary program to the installation.
To customize the primary installation to run a command
Create a network installation point that includes the product that you will install. For more information, see Create a network installation point for Office 2010.
Run the OCT by running Setup.exe from the root of the network installation point with the /admin command-line option. For example, run: \\server\share\Office14\setup.exe /admin.
In the Select Product dialog box, select the product that is the primary installation.
In the left pane of the OCT, select Licensing and user interface. In the right pane, set Display level to None, enter the Product key, and select I accept the terms in the License Agreement.
In the left pane, select Add installations and run programs. In the right pane, click Add.
In the Add Program Entry dialog box, perform the following steps for the executable that is chained.
For Target, enter the fully qualified path of the executable file that you want to run after the primary installation. For example, enter \\server\share\Office14\copylogs.bat.
For Arguments, enter the string of arguments to be passed to the executable. For example, enter: QuietArg="/q" Wait="30000".
As mentioned previously, command lines entered in the Add Program Entry and Modify Program Entry dialog boxes are intended to be used only for initial installs and uninstalls. Command lines are processed only during initial installs and uninstalls.
Select the Run this program after the Office product has been installed option to run the program listed in the Target box after the Office installation is completed. This is the recommended option.
You can also select the Run this program before the Office product has been installed option if you want the program listed in the Target box to run before the Office installation starts. However, if the program does not terminate correctly, or if it restarts the computer, Office is not installed, and programs further down the list do not run.
Make other customizations in the OCT as needed.
Save the Setup customization file (.msp file) with a unique name in the Updates folder of the network installation point.
Exit the OCT.
To install the product
Run Setup from the root of the network installation point. For example, if the primary product is Microsoft Office Professional Plus 2010, enter \\server\share\setup.exe
If you also used the Config.xml file to configure installation options in addition to the OCT setup customization .msp file customizations, run Setup from the root of the network installation point and specify the Config.xml file that you customized for the primary product. For example, if the primary product is Office Professional Plus 2010, enter:
\\server\share\setup.exe /config \\server\share\ProPlus.WW\config.xml
In the Select Product dialog box, select the primary product.
After Setup installs the primary product, it runs the arbitrary command or lightweight executable that you specified in the OCT.
You can put the customization files that you created in a location other than the Updates folder. Just add the /adminfile option to the Setup command lines in the procedures earlier in this section to specify the customization files to use. For more information about how to use Setup command-line options, see Setup command-line options for Office 2010.
How it works
The Setup program for the primary product follows the typical installation process. After that installation is complete, Setup runs the additional lightweight executable or arbitrary command that you specified in the OCT. Setup waits until each program is finished before it runs the next program.
It is important to run the primary Setup quietly. A chained Setup program cannot run if the primary Setup program is running interactively. You must run the primary Setup program with Display level set to None. We recommend that chained installations also be run with Display level set to None. And because you are running Setup quietly, you must enter the product key for each product in the OCT.
May 16, 2012