Share the Knowledge
RSS icon Home icon
  • How to automate Microsoft Office 2007 installation

    Posted on March 11th, 2009 webmaster 9 comments         Print Print

    I was just updating some documentation on our wiki and found some old notes on automating Office 2007 installation.  We upgraded our Microsoft Office software early last year from Office 2003 (and a few Office XP) to Office 2007 and this simple installation script saved us a lot of time. Here are the steps:

    Step 1.  Copy the contents of the Office 2007 installation CD (or package) to a network share (eg. \\server\Office12).

    Step 2.  Run the Office Customization Tool and create a setup customization file (I got these instructions from a BDD 2007 document on Microsoft’s website).

    1. Run the Office Customization Tool
      1. Go to Start->Run
      2. Type the following command:  \\server\Office12\setup.exe /admin
    2. Create a setup customization file
      1. In Office Customization Tool, Click OK to create a new setup file.
      2. Specify the Installation Path, Organization Name
      3. Add the network share location of the Office 2007 Installation Files Shared Folder. \\server\Office12
      4. Specify the Product Key and Accept the License Agreement. And Modify the Display Options.
      5. Configure other options
      6. Finally, Click File, Save As, and save the Setup Customization File to Office12\Updates Folder
      7. Close the Office Customization Tool

    Step 3. Download and install PowerShell.

    Step 4. Download and install PsExec.

    Step 5. Open a text editor (WordPad or Notepad is fine) and use the sample script below.  Save the file as office_2007_install.ps1.

    $hostname = “comp1″,”comp2″,”comp3″

    foreach ($i in $hostname)
    {
    &”c:\psexec\psexec.exe” -s \\$i \\server\office12\setup.exe /adminfile cust_file.msp
    }

    Replace comp1…comp3 with the computer’s hostname or IP addresss.

    Note: You can also pull the list of computers/IP addresses from a text file (one entry per line) by doing something like $hostname = Get-Content c:\computers.txt.

    Step 6. Schedule the script in Task Scheduler

    c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe -noexit “c:\office_2007_install.ps1


    Some suggestions:

     

    9 responses to “How to automate Microsoft Office 2007 installation” RSS icon

    • Nice easy to read guide the only problem is you have to sign the script so it will run in powershell, therefore the process gets very complicated! ill look for another way.

    • Good how to. Thanks for blog

    • Hi, great how to I’m having a few problems i was woundering if you could assist me with a few things. When I schedule the task to run it keeps stopping at the DOS

      This is what it reads….see below.

      prompt.c:\office_2007_install.ps1
      PS C:\WINDOWS\system32\WindowsPowerShell\v1.0>

      Here is the script that I copied from your page but I made some modifications.

      $hostname = “192.168.1.79,”

      foreach ($i in $hostname)
      {
      &”c:\psexec\psexec.exe” -s \\$i \\ssdpmsvr\installs\office2k7std\setup.exe /adminfile office2012.MSP
      }

      I saved it as a .pst

      Thanks for your help

      • Hey nanodroid,

        Maybe it’s because of the comma after the IP address?

        $hostname = “192.168.1.79,”

        Did you get any error message by any chance?

        • Ok here is the correction:

          $hostname = “192.168.1.79″

          foreach ($i in $hostname)
          {
          &”c:\psexec\psexec.exe” -s \\$i \\ssdpmsvr\installs\Office2K7STD\setup.exe /admin MO2k7.msp
          }

          I still get the same response in the DOS Screen:

          c:\office_2007_install.ps1
          PS C:\windows\system32\WindowsPowerShell\v1.0>

          • Hmmm…if there is no error message it might have already executed on the remote computer. Did you see the process executing on the remote machine right after you ran the command?

            Can you also check the Event Logs (eventvwr.msc) if there is any message from PowerShell? I believe PowerShell has a separate log file which you can view in Event Viewer.

            • I checked the event viewer and I didn’t have any errors there. I also checked the targeted PC and it didn’t upgrade to 2007…Do you think that I’m doing something wrong in regards to the script.

    • Got A question how long does this install take once the file has been executed.

      I did find one mistake that I was doing I didn’t put the .msp file in the updates folder. But I’m still getting the command prompt the just stay in that state…..does this process work with office 2007 standard, I have been seeing in some forums that you can’t do this unless you have office enterprise…is this true.

      • Hi Nanodroid,

        I don’t remember how long it took for us to complete each installation. It would depend on a lot of things such as the speed of the local network, how busy the server hosting the installation files is, how fast the target machine is, etc.

        I’m not sure if it works for Standard, I believe we purchased a volume license for Professional Plus.

        One test you could do is just log in to the target machine as a user with install privileges and execute the command from there and see if that works:

        \\ssdpmsvr\installs\office2k7std\setup.exe /adminfile office2012.MSP


    Leave a reply