Deploying the Microsoft Office 365 desktop apps has become an easy task with Intune. This is especially true for environments where all machines are being replaced or wiped, and enrolled via Autopilot. However, not everything can be that easy. What if you encounter an environment with hundreds or thousands of PCs with various versions of Microsoft Office installed? They’re tethered to AD, want to use Intune for app deployment and security, and are also cutting over a large email migration to M365 in a few weeks. Your only real choice here in the short term is to use Hybrid Entra ID Join so you can utilize Intune and Conditional Access. Don’t forget though, that old versions of Microsoft Office aren’t all compatible with Exchange Online. So, we need to get the M365 apps for enterprise deployed to all these workstations.
For more details on which version of Office desktop apps are supported when connecting to M365 services, see this link – Office versions and connectivity to Microsoft 365 services – Deploy Office | Microsoft Learn and New minimum Outlook for Windows version requirements for Microsoft 365 – Microsoft Community Hub (an older link but still relevant).
I’ll start by saying that this really isn’t very difficult, but Microsoft doesn’t do us any favors with the built-in Microsoft 365 Apps for Windows 10 and later Application. I personally don’t like using this, but it’s widely used due to the simplicity of the configuration and deployment. If we look at the options we have, we can see “Remove other versions”. If we hover over the tooltip, we can see hiding in plain sight that it specifically says Office MSI versions will be removed.
Unless people look at the tooltip, and even if they do, if they don’t know that there is a difference between the MSI installer of Office and the Click to Run version, then they’ll think this will remove all other versions of Microsoft Office. This isn’t the case though. C2R versions are NOT removed, and you’ll end up with a whole bunch of Not Applicable and/or Failed installations. Furthermore, MSI is a dying installation method and really hasn’t been used since Office 2016. Even with Office 2016, you need volume licensing to use the MSI installer. Office 365 Desktop Apps and Office 2019 (and newer) all use C2R technology for installation. So, as time passes, you’re less likely to encounter MSI versions of Office. The MSI Office 2016 install is still supported, but it is updated through Windows update, or manually (Latest updates for versions of Office that use Windows Installer (MSI) – Office release notes | Microsoft Learn). C2R has several benefits over the MSI installer. You can see details from Microsoft here – Information about Office Click-to-Run installation – Microsoft 365 Apps | Microsoft Learn.
So, how do we remove existing C2R versions of Office Desktop Apps? It’s actually rather easy, but we need to deploy the Office apps as a Win32 app. If we visit the Microsoft Learn link for Removing Existing MSI versions of Office, we can see a note that states:
Ah, OK, perfect. The remove element. This clearly states:
OK, so this is what we need. Since the built-in Intune Microsoft 365 Apps for Windows 10 and later Application does not give us the option to use the remove element, we need to use the ODT and craft an XML file to tell our installer that it needs to yank any version of Microsoft Office Desktop Apps and install the one we specify. Microsoft has made it much easier to create an XML file for installation. Using the Office Customization Tool (Office Customization Tool – Microsoft 365 Apps admin center) you can select your options and have an XML file generated for you. Once again, we get the option to remove MSI versions of Office, but no option for the remove element. We will need to add that manually.
Make your selections using the Office Customization tool and export your XML file. Once you have your XML, open it so we can add some elements. Depending on how mean you want to be to the users (or how urgent the situation is), you may need to add the FORCEAPPSHUTDOWN element to your XML along with the Remove element. The remove element can’t remove previous versions of Office unless they aren’t running. It’s likely that users probably have Outlook open all day. So, forceappshutdown gives you a way to enforce old versions are removed.
Here’s an example XML that will shutdown any running Office programs, remove any installed version (but leave MSI Visio/Project alone), and then install the Current Branch of M365 apps for enterprise:
<Configuration>
<Add OfficeClientEdition="64" Channel="Current">
<Product ID="O365ProPlusRetail">
<Language ID="en-us" />
<ExcludeApp ID="Groove" />
<ExcludeApp ID="Lync" />
</Product>
</Add>
<Property Name="FORCEAPPSHUTDOWN" Value="TRUE"/>
<Updates Enabled="TRUE" />
<Remove All="True">
</Remove>
<RemoveMSI>
<IgnoreProduct ID="PrjPro" />
<IgnoreProduct ID="PrjStd" />
<IgnoreProduct ID="VisPro" />
<IgnoreProduct ID="VisStd" />
</RemoveMSI>
<AppSettings>
<Setup Name="Company" Value="Your Organization" />
<User Key="software\microsoft\office\16.0\excel\options" Name="defaultformat" Value="60" Type="REG_DWORD" App="excel16" Id="L_SaveExcelfilesas" />
<User Key="software\microsoft\office\16.0\powerpoint\options" Name="defaultformat" Value="52" Type="REG_DWORD" App="ppt16" Id="L_SavePowerPointfilesas" />
<User Key="software\microsoft\office\16.0\word\options" Name="defaultformat" Value="ODT" Type="REG_SZ" App="word16" Id="L_SaveWordfilesas" />
</AppSettings>
<Display Level="None" AcceptEULA="TRUE" />
</Configuration>
Lastly, we need to package this up as a Win32 app and deploy it. That part is easy, but we will run through the important components below. We’re assuming you know how to package an intunewin file.
Download the Office deployment tool from here – Download Office Deployment Tool from Official Microsoft Download Center. When you run the ODT, it will ask you where you want to extract the files. I have a folder C:\ODT where I keep configurations. Extract it anywhere you want to, but remember where you extracted it.
You’ll see there are five files that were extracted. Setup.exe, and four example configuration files. We simply need our XML file from above in the same directory as the setup.exe file. If we want to add an uninstall configuration file, we can use the XML below:
<Configuration>
<Display Level="None" AcceptEULA="True" />
<Property Name="FORCEAPPSHUTDOWN" Value="True" />
<Remove>
<Product ID="O365ProPlusRetail">
</Product>
</Remove>
</Configuration>
So, we should have setup.exe, install.xml, and uninstall.xml in the same directory. Package that directory as an intunewin file for deployment as a Win32 app. For our install and uninstall commands, we simply use:
- Setup.exe /configure install.xml
- Setup.exe /configure uninstall.xml
For our detection rule, we have two registry detections:
- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\ClickToRun\Configuration
- Value: ProductReleaseIds
- Detection Method: String Comparison
- Operator: Equals
- Value: O365ProPlusRetail
- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\O365ProPlusRetail – en-us
- Value: DisplayVersion
- Detection Method: Version comparison
- Operator: Greater than or equal to
- Value: Add the version of the current branch or whichever branch you’re deploying
Assign to your groups and all your workstations will be on the same Current Branch version in no time 🙂