Blue Man Carrying a Heavy Question Mark in a Box Clipart Illustration As part of our VSTS Rangers automation exercise, I was confronted with two basic questions:

  1. How do I install Microsoft Office silently?
  2. How can I install Office, then Project and then Service Pack 2 sequentially using Powershell?

To tackle the first hurdle we digested blogs and TechNet documentation, sifting through the mountain ranges of information and producing two configuration files, one for Office and one for Project. The process for both is fairly similar and simple once you ignore all the noise.

Office 2007 Professional

  1. Find Config.xml in the Pro.WW directory and make a copy.
    image
  2. Edit the file as follows:
  3.    1: - <Configuration Product="Pro">
       2:   <Display Level="Basic" CompletionNotice="no" SuppressModal="no" AcceptEula="yes" /> 
       3:   <USERNAME Value="VSTS Rangers Trial" /> 
       4:   <COMPANYNAME Value="Microsoft" /> 
       5:   </Configuration>
  4. Use “basic” for Level, to get a bit of information appearing for the user, i.e. passive, not silent install.
  5. Use “no” for SuppressModal, otherwise errors will not show.
  6. Execute the following command to passively install Office: setup.exe /config yourconfigfile.config 

Project 2007 Professional Config

  1. Find Config.xml in the PrjPro.WW directory and make a copy.
    image
  2. Edit the file as follows:
  3.    1: - <Configuration Product="PrjPro">
       2:   <Display Level="Basic" CompletionNotice="no" SuppressModal="no" AcceptEula="yes" /> 
       3:   <USERNAME Value="VSTS Rangers Trial" /> 
       4:   <COMPANYNAME Value="Microsoft" /> 
       5:   <PIDKEY Value="" /> 
       6:   </Configuration>
  4. Execute the following command to passively install Office: setup.exe /config yourconfigfile.config

Once the above mechanics was figured out, putting it into a PowerShell script was do’able over a cup of coffee.

PowerShell script to automate Office, Project and SP1 installation

The .WaitForExit() method allows us to synchronize the installation.

   1: #<#  
   2: #.SYNOPSIS  
   3: #    This script Installs Office 2007 Professional and Office 2007 Project Professional
   4: #    Assumptions:
   5: #        +                                          << If we are here, we ecpect the config file here as well
   6: #               |
   7: #               +- Products                                << We also expect a Products directory and products within
   8: #                      +- Office 2007 Professional         << we run setup here for office
   9: #                      +- Office 2007 Project Professional << we run setup here for project
  10: #.NOTES  
  11: #    Author     : VSTS Rangers 
  12: #    Requires   : PowerShell V1
  13: #.EXAMPLE  
  14: # .\InstallOffice.ps1
  15: #> 
  16:  
  17: $current_Path  = $pwd.ToString()
  18:  
  19: $office_Setup  = $current_Path + "\Products\Office 2007 Professional\setup.exe"
  20: $office_Config = "/Config " + $current_Path + "\Office2007Professional.config"
  21:  
  22: $project_Setup = $current_Path + "\Products\Office 2007 Project Professional\setup.exe"
  23: $project_Config = "/Config " + $current_Path + "\Office2007ProjectProfessional.config"
  24:  
  25: $sp_Setup      = $current_Path + "\Products\en_2007_microsoft_office_suite_service_pack_2_x86.exe"
  26: $sp_Config     = "/Passive /NoRestart"
  27:  
  28: # -------------------------------------------------------------------------------------------
  29: function InstallOffice2007Professional
  30: {
  31: # write-host $office_Setup
  32: # write-host $office_Config
  33:   $process = [Diagnostics.Process]::Start($office_Setup,$office_Config)
  34:   $process.WaitForExit()
  35: }
  36:  
  37: # -------------------------------------------------------------------------------------------
  38: function InstallProject2007Professional
  39: {
  40: # write-host $project_Setup
  41: # write-host $project_Config
  42:   $process = [Diagnostics.Process]::Start($project_Setup,$project_Config)
  43:   $process.WaitForExit()  
  44: }
  45:  
  46: # -------------------------------------------------------------------------------------------
  47: function InstallSp2
  48: {
  49: # write-host $sp_Setup
  50: # write-host $sp_Config
  51:   $process = [Diagnostics.Process]::Start($sp_Setup,$sp_Config)
  52:   $process.WaitForExit()  
  53: }
  54:  
  55: # -Main--------------------------------------------------------------------------------------
  56: write-host "Install Office 2007 Professional"
  57: InstallOffice2007Professional
  58: write-host "Install Project 2007 Professional"
  59: InstallProject2007Professional
  60: write-host "Install Office Sp2"
  61: InstallSp2

You can find more automation and PowerShell chatter on Robert’s blog here, where he addresses the “the beautiful syntax and the commandlets” and other great features of PowerShell. We will be including a bunch of PowerShell scripts with the VSTS Rangers Virtualizing VSTS 2010 project and associated guidance.

image … at times it takes me longer to get there, but I do get there!

Did I mention (Zayd … listen up…), that I have finally taken the plunge to Windows 7 and am very, very happy. It took me a long time to find the right time, but I am happy with the new operating system both at the work and the home front, where my sons games that caused great drama with Vista, have started working again … causing great excitement amongst the ranks and a wave of intensive gaming :)