Installing Office 2016 Click To Run Via Group Policy

Posted on Posted in 2016, Click To Run, Group Policy, Office, Office 365, Office 365 ProPlus

Office 2016 Click To Run (which comes with Office 365 subscriptions) can be deployed via Group Policy, but there are a few things that you need to know and do first. These are:

  1. You cannot use the “Software Installation” features of GPO’s to deploy the Office 2016 click to run software as this is an exe file, and “Software Installation” runs MSI files.
  2. You cannot run software with elevated installation rights, as the setup.exe shells out to other processes to run the installation (the officeclick2run.exe service).
  3. You cannot just drop the 2016 versions of the files in an existing 2013 deployment folder and expect the clients to update automatically – you must install 2016 to upgrade it and install it for the first time.

Therefore you need to deploy the software via a computer startup script. But this is not simple either as startup scripts run each time the computer starts up (obviously!) but will run regardless of whether the software is already installed. Therefore you need to run the installation by way of a startup script that first checks if Office 2016 click to run has already been installed or not.

To do this you need to following:

  1. A read only file share containing the Office 2016 click to run files. Not this folder should not be the folder that already contains the Office 2013 files if you have them on your network.
  2. A read/write file share to store log files on (the deployment script logs the start and completion of the installation in a central location)
  3. An XML file to install Office 2016 click to run customised to your environment and the fact that you are using GPO deployment
  4. A batch file to detect an existing Office 2016 click to run deployment and if not present to install Office 2016 click to run from your file share.
  5. And finally the Office 2016 Deployment Tool setup program. This is not the same as the 2013 version of this program.

Steps 1 and 4 are part of a standard Office 2016 click to run deployment process and so not covered in this blog post. But once you have downloaded the Office 2016 Deployment Tool and created the XML file in step 3 you can run the deployment tool with setup.exe /download config.xml to download the Office binaries to the file share mentioned in step 1. If you have Office 2013 already deployed via this method (see for these steps) then make sure that this folder for the binaries is not the same folder as contains 2013 files. The Office 365 ProPlus installed (Office 2013 Click To Run) creates a subfolder called Office then another subfolder called Data. Into this it places (or and other files. This cab file contains info relating to the version number of the software in this folder and if you download 2016 to the same folder it will replace this file, but 2013 installed machines will still try and upgrade from this folder and fail. Therefore create another folder. This is shown in the example scripts below.

So here are the steps and details for doing all this for GPO deployment:

Creating Deployment File Shares

Create a software deployment file share that you have read/write access to and everyone else read only and create a folder called Office365ProPlus inside this to store the binaries.

Create a second file share that everyone has read/write access to (or CREATOR OWNER has write so that only the creator of the file can write it to the share and others can read or not see it at all). Create a sub folder in InstallLogs called Office365ProPlus.

In my demo these two shares and subfolders are called \\server\Software\Office2016 and \\server\InstallLogs\Office2016.

Create an XML File for Office 2016 Click to Run Deployment

This XML file is as follows and is saved to \\server\Software\Office365ProPlus root folder. Call this file config.xml. You can create this XML file using the wizard at

<Add SourcePath="\\server\Software\Office2016\" OfficeClientEdition="32" Branch="Business" >
  <Product ID="O365ProPlusRetail">
    <Language ID="en-us" />
<Updates Enabled="TRUE" UpdatePath="\\server\Software\Office2016\" Branch="Business"/>
<Display Level="None" AcceptEULA="TRUE" />
<Logging Path="%temp%" />

The important entries of no display and the Extended User Licence Agreement having been accepted are important, as GPO deployment works as a system service and so cannot display anything to the screen. Also see for the XML reference file for other settings you can contain here such as updates from the Internet (UpdatePath=””) or no updates (Updates Enabled=”FALSE”), the 2016 Branch value and multiple languages (add more <Language ID=”xx-xx” /> nodes to the file), etc.

Download the Office 2016 Click to Run Binaries

Download the Office Deployment Tool from and if you downloaded this a few months ago, download it again as it changes frequently and improves the setup process.

Install this software to get setup.exe and some example XML files. Copy setup.exe to \\server\Software\Office2016.

Run \\server\Software\Office2016\setup.exe /download \\server\Software\Office2016\config.xml to download the latest version (or the specified version if you have added Version=”″ to config.xml where is the build number you want to install). This will create the Office\Data folder in the \\server\Office365ProPlus share and download the binaries and any languages specified in the XML to that location – do not modify the folder structure as the Office Deployment Tool will expect this structure to find the files under during installation.

Create A CMD File To Script The Install

In Notepad create a cmd file and save it to <strong\\server\Office365ProPlus as well. It will eventually go in the GPO folder location, but this will be your master copy. The cmd file will look like the following and for this demo is called _InstallOffice2016GPO.cmd

REM *********************************************************************
REM Environment customization begins here. Modify variables below.
REM *********************************************************************
REM Set DeployServer to a network-accessible location containing the Office source files.
set DeployServer=\\server\Software\Office2016
REM Set ConfigFile to the configuration file to be used for deployment (required)
set ConfigFile=\\server\Software\Office2016\config.xml
REM Set LogLocation to a central directory to collect script log files (install log files are set in XML file).
set LogLocation=\\server\InstallLogs\Office2016
REM *********************************************************************
REM Deployment code begins here. Do not modify anything below this line (check quotes are quotes though).
REM *********************************************************************
IF NOT "%ProgramFiles(x86)%"=="" (goto ARP64) else (goto ARP86)
REM Operating system is X64. Check for 32 bit Office in emulated Wow6432 registry key
reg query HKLM\SOFTWARE\WOW6432NODE\Microsoft\Office\16.0\ClickToRunStore\Packages\{9AC08E99-230B-47e8-9721-4577B7F124EA}
if NOT %errorlevel%==1 (goto End)
REM Check for 32 and 64 bit versions of Office 2013 in regular registry key.(Office 64bit would also appear here on a 64bit OS)
reg query HKLM\SOFTWARE\Microsoft\Office\16.0\ClickToRunStore\Packages\{9AC08E99-230B-47e8-9721-4577B7F124EA}
if %errorlevel%==1 (goto DeployOffice) else (goto End)
REM If 1 returned, the product was not found. Run setup here.
echo %date% %time% Setup started. >> %LogLocation%\%computername%.txt
pushd "%DeployServer%"
start /wait setup.exe /configure "%ConfigFile%"
echo %date% %time% Setup ended with error code %errorlevel%. >> %LogLocation%\%computername%.txt
REM If 0 or other was returned, the product was found or another error occurred. Do nothing.

This will be run by GPO and at computer startup look for the Click To Run registry key that indicates Office has been installed. If not found for 64 or 32 bit OS’s and 64 or 32 bit installations of Office then it will deploy office.

Create A Group Policy Object

Create in your domain a GPO object over an OU that contains the computers you want to install Office 2016 click to run on. This will run on all computers in this OU, so start with a test OU containing one or a few computers or use permissions to lock the GPO object down to specific computer accounts.

In this GPO set the following:

  1. A startup script that runs _InstallOffice2016GPO.cmd. A startup script will have a folder the script is located in (click Show Files button in the GPO editor) and copy the above cmd file from the Office deployment share to this folder.
  2. Then click Add and select the file – there are no script parameters.
  3. Your GPO object will look like this.
  4. In Adminstrative Templates/System/Scripts set the Maximum wait time for Group Policy scripts to 1800 seconds. This is 30 minutes. The default is 10 minutes (600 seconds) but I have found Office installs take just over ten minutes on a LAN and longer if the fileshare is remote to the client computer. The script will be cancelled if it takes over 30 minutes, so you may need a higher value for your network.

Deploy Office 2016 Click to Run Click To Run

Run gpupdate /force on a test computer that is under the scope of your GPO object and then reboot the computer. The installation will start automatically and Office will be ready to use a few minutes after reboot. Office takes about 10 minutes to fully install on a LAN but can be used about 2 or 3 minutes after installation starts. Though in my lab with a low resourced file server it took 30 minutes to install. Do not reboot the PC in that time.

Check \\server\InstallLogs\Office2016 for a file named after the computer. This will have two lines, one for the start of the deployment and one at the end (with “Setup ended with error code 0” if successful).

92 thoughts on “Installing Office 2016 Click To Run Via Group Policy

    1. Hi, I have the script working fine. What exactly do you mean by it “doesn’t support office update”. The XML file contains the Update= value so that updates occur automatically when new versions of Office are dropped into the source directory.

      1. Hi,

        i’m talking about the CMD script to install O365.

        If you upgrade (to a newer version), the script will always check if the reg key exist. If it exists, it will never install the newer version…

        1. Correct. The 2013 script looked for a reg key that only exists once 2013 was installed and the 2016 key looks for a key that exists when Office 2016 exists. Therefore if you do not have any version of Office or Office 2013 C2R the script should run and update the software.
          I don’t understand the comment – if you upgrade to 2016 already, why would you need the script to upgrade to 2016 again?

          1. Ah, that’s different – that’s not an install of Office 2016 for the first time. To do the updates you customise the config XML file to include Branch= in the Add and Updates nodes (as shown above). Branch=Business will install the updates every four months from Microsoft automatically or from your file share if you have included a path to the Updates node. Branch=Current will do monthly updates and there are options for First Release as well (see for the options). Then when you want to update the clients either they download from Microsoft directly (no Update value) or from your file share (as in this example). All you do is update the version of Office in the 2016 file share by running the download again. You are in complete control of the updates and that is in the product. What this script does is control the initial installation of the product and sets how the automatic updates happen.

          2. Yes i know.

            but how to update with the last version with your script on a compuer with office 365 already installed ?

            Also, if i remove the /wait the installer is not continuing and with the /wait, it locks the computer for about 10 minutes. Do you know a way to avoid locking the computer ?

  1. Thank you for this!

    It works brilliant on fresh machines but I get the following prompt on machine that run Skype for Business 2015.
    “We need to remove some older apps”
    It prompts you to click “Remove and Continue”×234.png

    Is there anything I can put in the _InstallOffice2016GPO.cmd script to run this automatically as I’m looking to roll this out to around 150 users without them having to click anything.

    1. I’m guessing that you are rolling out Office 2016 Business and ProPlus already contains Skype? How did you roll out Skype for Business, can you roll out the uninstall in the same way and chain the two installers together – the one in this blog is just a cmd file, so it could be run by anything. Though at 150 users I would look into getting something to machine the machines more than GPO.

      1. Thanks for coming back to me Brian, what would you be using to roll the install out to machines? Something like SCCM?

        I customized the config.xml file to include the product ID for Skype for Business 2016.
        The script runs perfectly but just requires you to press the button to “remove and continue”
        I was just wondering if there was a way to customize the _InstallOffice2016GPO.cmd script to uninstall previous versions of office such as office 2010 and automatically hit “remove and continue” – Scripting knowledge isn’t the greatest.

        1. So yes SCCM is one of many options. Intune if you want it cloud managed, and third party products exist too.

          The uninstall of an application can be scripted to – its documented in the TechNet article for the product. So if you have Skype for Business 2015 Click to Run as part of Office 2013 Click to Run (i.e. it was Lync and it was in ProPlus) then you can roll out a script to uninstall. If it was the MSI version of the installer then you need to customise your installer process that was used back then to uninstall it.

  2. We’re upgrading from a mix of MSI-installed 2010 (all apps) and click-to-run 2013 (outlook only) on one PC, to click-to-run 2016. I’ve got scripts set up similar to what you’ve got above, and everything seems to work if I double-click the script. If I set it as a startup script, the installer runs and *appears* to complete successfully but doesn’t actually install anything. All the other components I’m using worked fine for a 2013 deployment.

    I made sure to set up this deployment as a fresh install source and didn’t attempt to drop it into the existing 2013 source folders, as I’m testing it all first. I’m just puzzled as to why the installer would work flawlessly if I double clicked it as an admin, but not through group policy.

    1. As I have not seen your scripts I cannot say why they are not working, but I suggest adding extra logging to the script and try again. For example, write out from the script the username the script is running as, domain membership etc. Check the fileshare has permissions for this account to access it. Record things like error status and other messages. Also look in the C2R installer logs in c:\windows\temp – they will be listed after the PC name. Look for errors here as well.

      The only obvious difference that can be seen from the info provided is the GPO scripts run as Local System ( and when you double-click the script it is running as your user/admin.

  3. Excellent post – thank you for this information. I have a question that I am not sure is clear from the post.

    Do you have any pre-existing office installation in your environment? We are trying to do this same thing – however, our clients are running a Click to Run installation of Office 2013. If I double-click the powershell script we have -it installs just fine. When I add it to the GPO I get an error. If I first uninstall office then install the new version, it seems to work fine. One potential hangup with this is – after this installation, Office 2016 is not associated with the user account Office 2013 was, and prompts the user to authenticate to their office 365 account. Ideally, I would love for this auth prompt to not happen.

    Any tips you could provide would be appreciated.

  4. We are deploying Office 2016 via the cmd script above and it’s working great! My question is with the set LogLocation=\\server\InstallLogs\Office2016 line. Do you know of a way to generate a new email and send the log file to a mail in database?

    1. So you could migrate it to PowerShell and use the Send-MailMessage cmdlet or call a PowerShell script or any other email sending script to pick up the created file as an attachment

  5. Hi, there is no setup.exe in the downloaded binaries. Also are you sure the paths you have here are correct? sometimes you use \\server\office2016 and sometimes you use \\server\software\office2016 ? Also where is the location of the Office365ProPlus folder and what it will contain? Can you please add pictures to how the folders look like to make more clear …. I am confused now. The process will work only if we copy o2016 from DVD not with the downloaded version with the command as there is no setup.exe

    1. Hi. There is no DVD for the version of Office 2016 that comes with Office 365. This document is for the Click to Run version of Office and not the MSI installed Volume Licence version.

      For reference and to cover all the asked questions. The setup.exe does not come with the Office download – it comes with the Office deployment kit. Separate download is mentioned in blog. Paths fixed in the blog.

      1. Thanks, the installion is starting and seems still need to connect to the internet to get some files, but the installion hangs and the log file is showing the below error so many times:

        Nexus Transport a426j Unexpected MsoGetRemoteHostNetworkStatusWithUrlType failed {“RemoteHost”: “”}

        and will keep trying on this for hours, the installation was aborted after almost 6 hours. Any idea what the issue is?

  6. I will assume that you have opened your firewalls to all the listed locations that the Microsoft Cloud services require access to for the Office application? You can find the list at This lists all the URLs (and IP’s if you don’t have a URL filtering firewall) that need to allow connections through and all URL’s that you should not be filtering or authenticating on your proxy server.

    From this URL list you can see that is accessed from the client computer where Office 365 ProPlus is running.

    1. MsoGetRemoteHostNetworkStatusWithUrlType usually means the path to the installation source on the network is wrong. So check everything. First if you have spaces try and get rid of them. If you cannot, try again and get rid of them – it will save a lot of issues. So I recommend \\\dfsroot\softwarelibrary\office\etc over “\\\dfsroot\software library\office\etc”. If you change the path to remove spaces make sure you update the installer path in the script and the SourcePath and UpdatePath in the XML file.

      Check that the setup /configure pathtoxml.xml is correct as well – try and enter the path in Notepad as a file to open. If you have a small typo then the file will not open. Again check the path to the XML for spaces as well. For example setup /configure \\\dfsroot\softwarelibrary\office\2016.xml is better than setup /configure “\\\dfsroot\software library\office\2016.xml” (note the quotes go around the file name and not the entire path to the script.

      And of course, in the script if you add quotes it is very likely to upset other quotes – so best to avoid spaces altogether (did I say that already?)

  7. Hi Brian,

    Its a great tutorial, and I’m working on it. But for some reason I get error code 5.
    Could you know that that means? and tell me what am I doing wrong?

    Best regards,

    1. Correct – that is why you use Computer Startup scripts to install it. Scripts that run here get admin rights. If you run the script as the user it will require admin rights.

      1. I too am getting error Code 5. I’ve checked and I don’t think it’s access denied on the shared folder with the install file. It’s running the script far enough to write the error to the log file. It’s interesting because when I run the batch file manually I get a UAC Prompt and it installs properly. Calling it via Group policy results in error code 5.

  8. Hi Brian,

    I had it working on my test environment, but now I cannot see why it doesn’t work. I get no log for about the installation process on workstations in the domain.
    Could you tell me please with who do I share the Office2016 folder? I did Domain Users

    And the policy should be applied to authenticated users or computers as well?

    Best regards,

  9. Hi Brian,
    Thanks for posting such post, i have configured successfully deployed office 2016 via startup scrip. but if office 2013 is already installed in systems in that case we are not able to deploy 2016 .
    as users are using 2013 and i am planning the deploy 2016 in background .

    please suggest ?

    Kamlesh Bhatt.

    1. You need to upgrade. 2013 and 2016 cannot coexist. Therefore you cannot deploy in the background. If 2013 is not running and you have a 2016 setup running it should upgrade your install. If 2013 is running the install/upgrade fails.

  10. This looks fantastic… I am however receiving an error in testing. I’ve run it from an Administrative Command Prompt.
    The script ends with “Setup Ended with error code -2147418113”
    Any ideas?

    1. I have lots of info for that error code. In Err.exe (Microsoft download, Exchange Server Error Reporting Tool, though it does everything and not just Exchange), that number comes up lots (and lots). Generally it means “E_UNEXPECTED”, so its an unexpected error – not that it helps you much. It could mean “MSG_NO_MEMORY” regarding certificates, “MSG_BAD_REGISTRY”, “MSG_TIMEPROV_ERROR”, and “ERROR_INVALID_FUNCTION”. So I would take another look at the script and make sure it contains no typo’s – that’s a common issue with downloading scripts from the internet – check the quotes etc. and make sure they work.

  11. Thanks for sharing this, Brian. I followed the steps closely and have it working perfectly in my test OU, with 2012R2 server and 8.1 clients. Next week, I shall be using it on our production OU for some new installs!

  12. Hi again,

    I’ve made it work, but am I still having some issues.

    For example, in my scenario, if I manually uninstall office from a user computer, and reboot, the office will not be automatically installed again, like in case of new computers.
    Is it possible that manual uninstall leaves some registry and other data in the user’s computers?
    I also don’t see the logs with the computer’s name and installation status.

    Are there any alternatives to detect if office is installed?

    Worth to mention that the guy before me installed Preview 3 of Windows Server 2016.
    I’ve just started for 4 weeks now as a Junior System Admin, and nobody in the company is helping me, so please, I would appreciate if you could give some advice Brian 🙂

    1. The script rings looking for a registry key. If not there, then there software installer runs. I have not checked the presence of the key after uninstall, but the key is a click to run key and not an Office key, so it might remain behind with an uninstall.

      So either change the batch file to query a key that is not present in both a new and uninstalled computer and let the installer run again

  13. First off, let me say this article has been awesome. Thank you for the work you put in to help us out.

    However, I am having the same problem as Alexandra has. I cannot get it to re-install after a manual uninstall. I have deleted the whole 16.0 registry key, but still no go from the GPO. I can manually run the CMD file and it works (of course it asks for admin permissions), but the GPO should not need since the script is in the computer configuration of the policy.

    Is there some other “switch” that gets triggered within the GPO that prevents it from running again?

    1. So I have not tested this script with uninstalls (or indeed anything fancy). The script just looks for the lack of a registry key and if the key is not present assumes the product is not installed (this is of course one of many ways to test for the presence of an application, it may not be the best way!). If key not present then it starts the installer. Of course the installer may fail here independently of any registry key. If the key does not exist, the installer will start. The installer will do its own checks and fail or complete. These checks will be logged in the the Office logs in %temp% (if you allow logging in the config file that is). Therefore in your case, though you have deleted the regkey, the installer is making its own decisions on what to do and if failing independently of this simple script.

  14. Hi,

    I have about 500 end users and the problem I have is that my staff randomly installed both 32 and 64 bits versions of Office365 2013 on all of our 64 bit machines. Is it possible for the script to determine the BIT version installed and upgrade Office accordingly?



  15. Good article! What if you would like to change the content of the 2016 deployment, let’s say you want to remove Access 2016 and add Project 2016? You need to run the installation again with a modified configuration.xml I guess?

  16. Do you know how to modify the script to also check for non-click2run installs? C2R won’t install on a PC which already has an MSI version installed, so we want to avoid running the installer.

  17. Hi Brian,

    First, thanks for posting this useful info.
    So my questions is regarding upgrade the users from office 2013 to 2016. Is there way I can keep the office 2013 while office2016 is installing. Or how can I remove office2013 and install 2016 using script. Any help will be appreciate.


  18. I want to create a startup script to install a software but I have never done it before its outside my field. please assist with pre-created script that will run via GPO

  19. Hi Brian,

    Would like to ask for your help. im currently installing Skype for Business Entry Retail 2016 via GPO right now, the GPO execute and install but the logs doesn’t work? none log files stored in the logs folder. here is my script:

    IF EXIST “C:\Program Files (x86)\Microsoft Office\root\Office16\lync.exe”
    (goto End)
    else IF EXIST “C:\Program Files (x86)\Microsoft Office\root\Office15\lync.exe”
    (goto End)
    else IF EXIST “C:\Program Files\Microsoft Office\root\Office16\lync.exe”
    (goto End)
    else IF EXIST “C:\Program Files\Microsoft Office\root\Office15\lync.exe”
    (goto End)
    else IF EXIST “C:\Program Files\Microsoft Offic\Office16\lync.exe”
    (goto End)
    else IF EXIST “C:\Program Files\Microsoft Office\Office15\lync.exe”
    (goto End)
    else (goto Install)
    REM Set DeployServer
    set DeployServer=\\\odt\
    REM Set ConfigFile
    set ConfigFile=\\\odt\configuration.xml
    REM Set LogLocation
    set LogLocation=\\\odt\logs
    REM Start Install
    echo %date% %time% Setup started. >> %LogLocation%\%computername%.txt
    start /wait %DeployServer%\setup.exe /configure %ConfigFile%
    echo %date% %time% Setup ended with error code %errorlevel%. >> %LogLocation%\%computername%.txt

    1. Sorry – I cannot help you troubleshoot scripts in this blog. There is no guarantee that things like quotes or paths etc. are correct in the script you are running and I cannot see your environment from here and so cannot help. If you want help then we can provide support on an hourly basis to assist and then we would arrange remote or onsite access to work through the issues you are having. Please give us a call.

  20. Hi!
    Our company has a license for Office 2016 Professional so I have a MAK key for this product. Is it possible to use your ‘Click To Run’ solution with this MAK key? I installed the Office as you wrote in this tutorial but after installation when I tried to change the product key I get an error message. I think this Office version isn`t compatible with our MAK key.

  21. Thanks for putting this together, however, setting up the GPO policy to run as a startup script against the test OU is not working. Please advise

  22. Hi again!
    I send you this comment on august 8:
    Our company has a license for Office 2016 Professional so I have a MAK key for this product. Is it possible to use your ‘Click To Run’ solution with this MAK key? I installed the Office as you wrote in this tutorial but after installation when I tried to change the product key I get an error message. I think this Office version isn`t compatible with our MAK key.
    Can you help me? I am waiting your answer.
    Thank you!

  23. Hi Brian,
    When I run the script, Office does not install because of this- “error code 0-1008(0)” ( Is your internet connection working? Do you have enough free space on your main hard drive?). The log file reads, ” Setup Ended with error code -2147418113″. How do I get rid of this?
    Thank you

  24. Ok, i am having a little trouble getting this to work. I would love it if you could provide any answers to the following questions.

    1. should this startup script be a Computer Policy or a User Policy ?
    2. in the script should i be removing all the REM and numbers?
    3. set DeployServer=\\ServerName\PATH\ ….. should this be pointing to the path where the setup.exe file is ? Or should it be set to the path where the software is downloaded ? Also if it is the path where the setup.exe lives should i be pointing directly to that file ? like \\servername\path\path\setup.exe ?
    4. last but not least the set ConfigFile=\\servername\path\path\config.xml is this correct? or should it be setup.exe\config.xml?

    I can run the Click to Run fine if i map a network drive and invoke the install process manually. I would love to get this logon script working and save me a lot of work.

    Thanks for any help in advance.

    1. Hi Charles, its a computer startup script as written in the post above. The REM’s – no leave them. The numbers – don’t copy and paste the script from the webpage, but click the icon to the top right of the code to view the code and not what is rendered in the webpage. The numbers are for reference and are not part of the code.

      The DeployServer path should be set to a network-accessible location containing the Office source files. These files when downloaded with setup.exe always create a office\data folder path. You are pointing to the root folder of this path that contains the Office subfolder. This is the same folder that you enter into the XML file to download Office binaries into.

      Finally, the script is correct. The ConfigFile setting goes to the XML file and not setup.exe\config.xml as that is not a valid path. Line 26 in the code reads “start /wait %DeployServer%\setup.exe /configure %ConfigFile%”. This is the line that does the work. It runs setup.exe from the DeployServer path (so that is dropped into the root folder that you download to) and then /configure switch is run to tell Setup where the XML file is.

      Of course the path needs to be valid, the XML needs to be correct. This blog post does not cover getting these right, as that is part of Office deployment generally. This blog covers automating an already working installation and for that understanding of scripting files, exes and paths is necessary.

  25. Great tutorial but a little confused;

    Create a software deployment file share that you have read/write access to and everyone else read only and create a folder called Office365ProPlus inside this to store the binaries.

    Ok – \\server\Software\Office365ProPlus

    Create a second file share that everyone has read/write access to (or CREATOR OWNER has write so that only the creator of the file can write it to the share and others can read or not see it at all). Create a sub folder in InstallLogs called Office365ProPlus.

    I’m assuming you mean create \\server\Software\InstallLogs and then a subfolder inside of there call Office365ProPlus?

    e.g. \\server\Software\InstallLogs\Office365ProPlus

    In my demo these two shares and subfolders are called \\server\Software\Office2016 and \\server\InstallLogs\Office2016.


    What about the Office365ProPlus folders?

    1. Office365ProPlus is just an example as the name of the software you are installing. If you are on the Small Business SKU of Office 365 you might want to call it Office2016Business, it does not matter as long as the same named folder is referenced in the script and in the XML file and in the setup /download to pull down updates. Get the folder names out of sync and this does not work. Best suggestion is copy the script and use the names I use – then you need to change nothing apart from the server name.

  26. Hi Brian,

    I am also receiving an error code of 1602 when the device hits the logon screen.

    I have tested my policy and the modified script you provided in my lab and it deploys using a VM copy of our SOE and displays error 0. The install appears to have successfully deployed.

    It is once i test the deployment on a production machine that this error occurs.

    I have granted “everyone” read/write on the share. Initially i thought it was office iteself launching in the users context causing the install to abort however if left unattended at a logon screen the same error is thrown.

    I have reviewed the deployment logs but there is nothing useful here.

    Any suggestions would be great 🙂

  27. I got the script working, but it appears that the registry key check isn’t working. In other words, it tries to install Office 2016 each time the script runs. It also apparently uninstalled Office 2016 for one of our users. Any ideas? We are deploying it to Windows 10 Machines.

    1. Run the reg query line manually and then %errorlevel% and see what you get. Check if the reg key exists. It might from a previous attempted install. It might be for your install and version you need to find a key that is not there until it is installed. The key in the script did that for me, but that might have changed since I wrote the post.

  28. I have tried this with mixed results. As far as I can tell I have done everything correct but the script never runs. I can access the network share form the client computer but running the cmd file from there does nothing whether I run it normally or as administrator, but if I open a command prompt and paste in the contends of the cmd file(control A to get it all then copy paste) then the procedure kicks off no problem. Any thoughts?

    1. The batch file under a GPO runs under the computer account, not a user account. Make sure permissions are such that computers can write to the share and not just users.

  29. Hi Brian,

    Thank you so much for taking the time to get this all written up. I was able to follow your instructions, but am having one tiny issue. The batch file I created for the GPO to install Office works great when run manually. Program installs, log file is created, no problems! However, when I create and test the actual GPO, using the same batch file at startup, it does not appear that the log file is being created. Office is still installing, if not already present, but the log file never gets created. Any idea what I could be doing wrong here?

    1. Nevermind! I had forgot to throw CREATOR OWNER permissions on my InstallLog share. All good now! Thank you again fo such an excellent write up!

      Best wishes,

  30. Hi,

    I’m attempting to upgrade Office 365 2013 to 2016 via SCCM. I can successfully install by making the Application available within the Software Center. However, when making it required and assigning it to my test collection I get a failure at 65%. The error code returned is 17004. I have successfully installed via the Software Center multiple times. My application is set to download and run locally from the client ccmcache folder. A lot of threads suggest using GPO to perform the upgrade instead of SCCM. Any idea why I can install from the Software Center but not when it is a required application?

  31. Hi…when I run the CMD manually it runs fine. When I try from GP it does not run, GPresults show the policy is applied. Any ideas

  32. Hi Brian – Thanks for posting these two articles on deploying Office 365 via GPO. I was able to build on this script, testing for and removing Office 2007 and Office 2013 prior to installing Office 2016. Works great, thanks again.

  33. Hey Brian, I’m testing your process and find that my machines are not waiting for the setup.exe task to complete before bringing up the windows logon screen and allowing me to log in. Do you see the same behavior? Reason I ask is the install is failing when trying to deploy using group policy as described in your article, but the script runs fine if I log in and run it manually as admin user.

    When I log in after trying to deploy using group policy, I see the log file created by the script (“Installation started…”) and I see various click2run log files indicating the install had started, but I see various errors in those logs including this one: “upgrade failed with error code 17002”.

    Regarding that error, I read elsewhere that I have to *wait* for the installation to complete before logging in to the machine but that hasn’t worked, plus I assumed that was the point of the “start /wait” command in your script.


    1. If the script, which has no real error handling (as its a basic batch file) errors and the setup.exe fails to run for any reason, then start /wait does not matter as the setup.exe has finished and the login process starts. Your error says upgrade failed – you cannot upgrade Office 2016 C2R with setup.exe, you have to uninstall Office 2013 C2R first.

    1. 1603 is “Fatal error during installation”. This is got from the err.exe tool, which I think used to be called the Exchange Server Error Codes tool (or similar) but contained all the Windows errors codes as of abut ten years ago – but error codes are reused for similar things so still a useful tool

Leave a Reply

Your email address will not be published. Required fields are marked *