This script is for updating the cached files for Office Click-to-Run installs. In our environment, we are Office 365 subscribers and we wish to use the Click-to-Run version of Office. There is an Office Deployment Tool for Click-to-Run (a version for Office 2013 and a version for Office 2016). This script clears out the cached items, runs the downloaders to get the latest build of Office, then replicates it out to the deployment folders for you (so you don't have to then run the UpdateMedia.ps1 script).

In our environment, we store the Office "bundle" in the following directory structure:

  • \Source.Apps\Microsoft\MSFT.Office365.16.ProPlus
  • \Source.Apps\Microsoft\MSFT.Office365.16.ProPlus.DeploymentTool
  • \Source.Apps\Microsoft\MSFT.Office365.ProPlus
  • \Source.Apps\Microsoft\MSFT.Office365.ProPlus.DeploymentTool

The *.ProPlus folders hold the downloaded cache of installation files. The *.ProPlus.DeploymentTool folders hold the deployment tools themselves and associated scripts.

UpdateOffice.cmd

@echo off
echo.
echo Updating Office 365 Sources
echo.
echo Cleaning out master repository of old versions to save disk space
pushd D:\Source.Apps\Microsoft\MSFT.Office365.ProPlus
rmdir /s /q Office
popd
pushd D:\Source.Apps\Microsoft\MSFT.Office365.16.ProPlus
rmdir /s /q Office
popd
echo Initiating download of 2013.  This takes a while and there is no progress (sorry!).
pushd D:\Source.Apps\Microsoft\MSFT.Office365.ProPlus.DeploymentTool
setup /download configuration.xml
popd
echo Initiating download of 2016.  This also takes a while.
pushd D:\Source.Apps\Microsoft\MSFT.Office365.16.ProPlus.DeploymentTool
setup /download configuration.xml
popd
echo Copying over to root deployment share
ROBOCOPY D:\Source.Apps\Microsoft\MSFT.Office365.ProPlus "D:\DeploymentShare.ROOT\Applications\Microsoft Office 365 ProPlus Binaries 2013" /MIR
ROBOCOPY D:\Source.Apps\Microsoft\MSFT.Office365.16.ProPlus "D:\DeploymentShare.ROOT\Applications\Microsoft Office 365 ProPlus Binaries 2016" /MIR
echo Copying over to media deployment tree
ROBOCOPY D:\Source.Apps\Microsoft\MSFT.Office365.ProPlus "D:\DeploymentMedia1\Content\Deploy\Applications\Microsoft Office 365 ProPlus Binaries 2013" /MIR
ROBOCOPY D:\Source.Apps\Microsoft\MSFT.Office365.16.ProPlus "D:\DeploymentMedia1\Content\Deploy\Applications\Microsoft Office 365 ProPlus Binaries 2016" /MIR
echo.
echo All finished!

Install.cmd for Office 2016

@echo off
setlocal

REM Share out path
net share office16 /DELETE
pushd "..\Microsoft Office 365 ProPlus Binaries 2016"
net share Office16=%CD% /GRANT:Everyone,CHANGE

REM Create Configuration.XML
ECHO ^<Configuration^> > configuration.xml
ECHO ^<Add SourcePath="\\%COMPUTERNAME%\Office16\" OfficeClientEdition="32" Branch="Current" ^> >> configuration.xml
ECHO ^<Product ID="O365ProPlusRetail"^> >> configuration.xml
ECHO ^<Language ID="en-us" /^> >> configuration.xml
ECHO ^</Product^> >> configuration.xml
ECHO ^<Product ID="VisioProRetail"^> >> configuration.xml
ECHO ^<Language ID="en-us /^> >> configuration.xml
ECHO ^</Product^> >> configuration.xml
ECHO ^</Add^> >> configuration.xml
ECHO ^<Display Level="None" AcceptEULA="TRUE" /^> >> configuration.xml
ECHO ^<Logging Path="C:\Windows\Temp" /^> >> configuration.xml
ECHO ^</Configuration^> >> configuration.xml

REM Initiate install
popd
start /wait "" setup.exe \\%COMPUTERNAME%\Office16\configuration.xml

REM Cleanup share
net share office16 /DELETE

We actually use this particular Install.cmd for the Office 2016 version of the installer. It is kept in the MSFT.Office365.16.ProPlus.DeploymentTools folder.

In MDT, we import both the *.ProPlus and *.ProPlus.DeploymentTools folders. We call one Microsoft Office 365 ProPlus Binaries 2016 and the other Microsoft Office 365 ProPlus Setup 2016. The Install.cmd routine is called on the Setup folder, which then references over to the binaries. By doing it this way, we ensure that the binary files are kept in sync with the destination.

You'll need to be sure that the Net Share statements reflect a valid path in your environment.