Installing Office 365 ProPlus Click To Run Via Group Policy

Note: Article updated October 2018 to remove references to “Office 2016” and replace it with “Office 365 ProPlus” as the rollover to the 2019 release is seamless and does not change this products name.

Note: Article updated April 2018 to support the new Channel names and XML updates

Office 365 ProPlus 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:

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.

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).

You cannot just drop the latest 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. This is not the case with the “2019” release. An existing installation installed before the “2019” release in October 2018 will seamlessly move to this version at the next applicable update.

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 365 ProPlus click to run has already been installed or not.

To do this you need to following:

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.

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)

An XML file to install Office 365 ProPlus click to run customised to your environment and the fact that you are using GPO deployment

A batch file to detect an existing Office 365 ProPlus click to run deployment and if not present to install Office 365 ProPlus click to run from your file share.

And finally the Office Deployment Tool setup program. This software has been updated a few times over the years, so ensure you download the current version before starting.

Steps 1 and 4 are part of a standard Office 365 ProPlus click to run deployment process and so not covered in this blog post. But once you have downloaded the Office Deployment Tool and created the XML using the creator tool at https://config.office.com you have your configuration.xml file. In step 3 you can run the deployment tool with setup.exe /download configuration.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 http://c7solutions.com/2014/09/installing-office-365-proplus-click-to-run-via-gpo-deployment for these steps) then make sure that this folder for the binaries is not the same folder as contains 2013 files. The Office installer for Office 2013 Click To Run creates a subfolder called Office then another subfolder called Data. Into this it places v32.cab (or v64.cab) and other files. This cab file contains info relating to the version number of the software in this folder and if you download the current version 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\Office365ProPlus and \\server\InstallLogs\Office365ProPlus.

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 https://config.office.com

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 http://technet.microsoft.com/en-us/library/jj219426(v=office.15).aspx 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 Channel value names and multiple languages (add more <Language ID=”xx-xx” /> nodes to the file) or to match the language to the OS (MatchOS, with Fallback language and allowing internet download if the language is not available with AllowCdnFallback), etc.

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

Run \\server\Software\Office365ProPlus\setup.exe /download \\server\Software\Office365ProPlus\config.xml to download the latest version (or the specified version if you have added Version=”15.1.2.3″ to config.xml where 15.1.2.3 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 _InstallOffice365ProPlusGPO.cmd

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:

A startup script that runs _InstallOffice365ProPlusGPO.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.

Then click Add and select the file – there are no script parameters.

Your GPO object will look like this.

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 365 ProPlus 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\Office365ProPlus 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).

114 thoughts on “Installing Office 365 ProPlus Click To Run Via Group Policy”

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.

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?

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 https://technet.microsoft.com/en-us/library/jj219426%28v=office.15%29.aspx 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.

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.

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.

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.

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.

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.

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.

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?

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

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.

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 \\domain.com\dfsroot\softwarelibrary\office\etc over “\\domain.com\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 \\domain.com\dfsroot\softwarelibrary\office\2016.xml is better than setup /configure “\\domain.com\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?)

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.

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?

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 .

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.

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.

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!

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 🙂

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

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?

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.

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?

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?

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.

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:

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.

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.

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!

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
Harsh

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.

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.

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.

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.

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 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.

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.

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?

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?

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?

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.

I have problem, at the moment office 2007 is installed on our client machines, now we decided to migrate to office 365 and i tried to try this script and install office 365 and remove 2007, but so far no luck, can you please put some light on the steps that you did or if you can share the scripts. thank you

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.

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.

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

Once the ‘UpdatePath’ is set and the ‘UpdatesEnabled’ is set to True, do users still have to manually click Update Options->Update Now within one of the products in order to get the newest update or will it automatically see the update and install it? It appears I can only get it to update when I manually do this whereas I am looking for Office to recognize when there is an update and install it automatically. This is for Office 2016.

You need to wait a while before it will automatically do it. First it checks each Tues and Sunday for if an update is available at the UpdatePath. Then it downloads it. Then when that is complete (using BITS, so its not a network interrupting, but a slow and steady download) it will alert you via the Backstage area (under File menu). After a while, it will draw a banner across the top of the app to tell you. Once it is downloaded, all you need to do is restart all the Office apps for the update to process. So for example, rather than clicking update you restart the PC (which restarts all the Office apps) it will update on the next time you start the first Office app. If you never restart all Office apps together (i.e. never reboot) then you will go through the backstage alert and then the banner alert

Hi Brian,
I am having issues with the script running as a start up script. it will run as a logon script but when i change it to startup i get either error code 2 or error code 0 in the log file. can you please let me know what these code mean.

Here are the codes im using. can you please let me know if there are any glaring issues
The pushD command was not working for me so had the script map the drive then just change to it.

setlocal
REM *********************************************************************
REM Set DeployServer to a network-accessible location containing the Office source files.
set DeployServer=\\xxxxxxxxxx\Office2016_Deploy
REM Set ConfigFile to the configuration file to be used for deployment
set ConfigFile=\\xxxxxxxxxx\Office2016_Deploy\configuration.xml
REM Set LogLocation to a central directory to collect script log files (install log files are set in XML file).
set LogLocation=\\xxxxxxxxx\Office2016_Deploy\Office2016_InstallLogs
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
:ARP64
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)
:ARP86
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.
:DeployOffice
echo %date% %time% Setup started. >> %LogLocation%\%computername%.txt
net use y: \\xxxxxxxxr\Office2016_Deploy
y:
start /wait %DeployServer%\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.
:End
Endlocal

What permissions do you have on the install folder. It needs to be as above, as start scripts run in the context of the computer account and not the user account aka logon scripts. Permissions need to be EVERYONE read and not DOMAIN USERS read for example

It Ended up being an issue with the XML file i have resolved it. Now i am getting a new problem. one that you will most likely not be able to assist with. I am just hoping that you are someone else reading this has encountered the issue before . After I apply the script to a computer on my domain that computer is then unable to boot. it gets stuck at the black screen with spinning dots( no windows logo) i am certain it is a driver issue as i am able to boot in safe mode. Hoping someone he had this issue and found a fix for it. Thanks.

Hello Brian,
I am having an issue where the client machine recieves the policy and run the scrip, but the installation dont progress. The log file have the “setup started” message and i can see the process setup.exe in the resource monitor but the installation never ends.
Can u give me any advice?

If the officeclick2run service is installed and started by the script (which is all that the above really does), the C2R service then installs Office based on the settings in the XML file. If the Office installer is failing it is logged to C:\Windows\Temp

Hello I have tested on my account that has admin rights and works flawless, but on a domain the user the script initiates, but they get prompted by the UAC for admin credentials to install. I have applied every permission that is needed to the file share with files and they still get prompted. Any suggestions? thanks

The script is designed to run via Group Policy under the Computer startup scripts. Computer startup scripts run with elevated permissions as this is needed for the installer. The installer installs the Click2Run service and the Click2Run service is what installs and upgrades Office. Therefore you do not need computer startup scripts to upgrade office, but you need them to get the service installed on the machine. So what you see if you just run the script is correct – just running the script and you need to provide elevated permissions

Standard troubleshooting for this is to run the script from inside a cmd prompt on the client in question and see what it does. It will not disappear quickly if run from the console, but will if double clicked. Then after that check the logs if it gets as far as running the Office installer

We deployed O365 in this manner 10 months ago, and clients were getting updates from Microsoft(Monthly Channel). We want to change the channel and now exclude the Teams app. If we modify the cmd file so that it re-reads the config.xml, it then re-installs the old version that we had on the network for the initial install.
Are we not able to change the configuration without re-installing? Do I need to ensure that my downloaded Office Data is at the latest client update version each time I need to make a config change? I’m just trying to understand the standard process here and I can’t find proper documentation for a situation like this. Any help would be appreciated.

The config file controls the initial installation and not any of the updates. Therefore when Microsoft add Teams to the update, you will get it automatically. When Microsoft add Teams to the installation, you can control it by excluding it in the config. To avoid removing and reinstalling, you can via the GPO set Teams not to auto-start when the user logs in. Then you can have Teams installed but never prompted for use and so the likelihood of the user finding it and running it is considerably reduced.