This post continues on from my other blog post Fully automate the removal of any Office version in preparation for Office 365. Once all Office software versions have been removed from the computer, you’ll then need to automate the installation of Office 365 on the back end of the un-installation of all legacy Office versions. This guide will demonstrate how to automatically install Office 365 using Group Policy.
First, you’ll need to download and install the Office Deployment Tool for Click-to-Run. Install this on a dedicated (file) server which will host the share and will hold a local copy of the Office 365 setup files. Beware, the Office 365 source files are around 1GB in size. If you have several sites separated by slow WAN links, you would want to dedicate a server for each site that will hold the source files, so repeat these steps for each site server. Once you have installed the Office Deployment Tool for Click-to-Run, this program will give you two files setup.exe and configuration.xml. This is all you need to 1st: download the Office 365 source files from the internet to a local repository and 2nd: Install Office 365 silently.
Download the Office 365 source files
To download the source files to your local server, first create a share and grant the everyone group read permission to the share. In my example, the share is called OfficeSource.
Edit the configuration.xml file, change the UNC path to suit your configuration.
<Configuration> <Add SourcePath="\\<server>\OfficeSource\" OfficeClientEdition="32" > <Product ID="O365ProPlusRetail"> <Language ID="en-us" /> </Product> </Add> <!-- <Updates Enabled="TRUE" UpdatePath="\\Server\Share\Office\" /> --> <!-- <Display Level="None" AcceptEULA="TRUE" /> --> <!-- <Logging Name="OfficeSetup.txt" Path="%temp%" /> --> <!-- <Property Name="AUTOACTIVATE" Value="1" /> --> </Configuration>
Then run the the following command:
setup.exe /download configuration.xml
Install Office 365 silently
To install Office 365 silently, it’s as easy as running a similar command:
setup.exe /configure configuration.xml
Group Policy Integration
- You will need to create a service account to be used for the automated install process. The account I used was a member of the Domain Admins group in Active Directory so that the account would have local admin access on all domain joined member machines by default. I called this account svc.admin_install
- Create a user based group policy and map it to the AD Site which contains your users. Reason why I say attach to a site, so that you can create different server shares which are local to each site and specify them differently for each site based GPO. Create a scheduled task, I called this Install Office. Change the account that is used for the running of the task to the account you setup before and enter in the password when it prompts.
- Set the trigger to run at user logon
- For the action, add in “%windir%\Office_in.bat”
- There is a batch file script that needs to be distributed to the computers. Using the same group policy object, configure Files under Group Policy preferences.
The destination for this file would be %windir%\Office_in.bat
The source of this batch file can be located in any location, however as we are using a GPO, I would recommend using the logon script folder as follows:
This batch has the following contents.
@echo off cd %SystemDrive%\users dir /s O551c3_1n.txt if errorlevel 1 goto end dir /s C0mp1et3_0ff1c3.txt if not errorlevel 1 goto end \\<server>\OfficeSource\Setup.exe /configure \\<server>\OfficeSource\configuration.xml echo Office 365 Install Complete > %SystemDrive%\users\C0mp1et3_0ff1c3.txt :end exit
C0mp1et3_0ff1c3.txt – This file indicates that the Office 365 install process has completed. This file is located %SystemDrive%\users
O551c3_1n.txt – This file indicates that all legacy versions of Office have been removed and is created upon completion of the uninstall script in my other post. This file is located %SystemDrive%\users
As this post continues on from my other post to uninstall Office. When this install script is executed, it checks for O551c3_1n.txt, only if this file is found, the script continues. This script then looks for C0mp1et3_0ff1c3.txt, if this file doesn’t exist, the script continues.