
Table of Contents
Introduction
Many organizations are upgrading from previous versions of Microsoft Office to Microsoft Office 365 ProPlus. My favorite way to deploy Office 365 ProPlus is by leveraging the excellent Powershell App Deployment Toolkit.
Many of these organizations have locations all around the world, with requirements of local language support.
I have seen that deploying Microsoft Office 365 ProPlus in large enterprise environments is not as trivial as you might think, as you have to consider many things.
Unlike Office 2016 or Office 2019, Office 365 ProPlus is a click-to-run installation, which means that there is no MSI file that you can use.
The way described in this blog post is how I deploy the Office 365 ProPlus installation, and I have frankly not found a better way to do it. You can use the solution in any management system, not just SCCM.
Assumptions
Since I can not go into too much detail in this blog post, I have to make some assumptions:
- Experience with deploying applications in Microsoft Endpoint Configuration Manager (SCCM)
- Knowledge of Microsoft Office Deployment Toolkit (ODT)
How To Deploy Office 365 ProPlus
The Office 365 ProPlus deployment solution:
- Based on Powershell Application Deployment Toolkit 3.6.9
- Uninstall previous versions of Microsoft Office 2007-2016
- Install the Microsoft Office 365 ProPlus language according to the OS language culture
- Displays pop-up asking the user to close Microsoft applications if they are open
Uninstall previous Microsoft Office installations
To altogether remove an old installation, I use Offscrub, which is a script provided by Microsoft. These scripts have been around since Microsoft Office 2007 and are also available for Microsoft Office 365 ProPlus.
The solution supports the removal of Microsoft Office 2007-2016.

Note that you might want to modify the section depending on what you want to remove. In my case, I’m running CLIENTALL. I have noticed that this can sometimes remove more than you intended, so test it out before rolling it out into production.
*Update 2018-12-21*
Microsoft is deprecating the Offscrub scripts in favor of the feature set in the new Office Customization Toolkit available at config.office.com and also in Microsoft Endpoint Configuration Manager (SCCM).
How to configure support for multiple languages in Office 365 ProPlus
This Microsoft Office 365 ProPlus deployment solution analyzes the computer’s OS culture and then applies an XML configuration file, depending on the outcome.

In the default solution, I only have English and Swedish defined, but you can select other languages.
If the OS language does not match any language in the list, it automatically falls back to en-us.
Implement the Powershell script to install Office 365 ProPlus using SCCM
Download the Powershell App Deployment Toolkit solution
Download the Microsoft Office 365 ProPlus solution.

A description of the different files:
- Deploy-Application.exe – Executable used for triggering the Deploy-Application.ps1 file.
- Psexec/Psexec64.exe – Required for user interaction on Windows 7 32-bit because of session 0.
- ServiceUI_x64/x86.exe – Required for user interaction under session 0.
- Invoke-Installation.ps1 – Wrapper script to trigger the installation.
What is Session 0, and why is it an issue?
Session 0 is a non-interactive mode, where all user interaction actions are blocked. Session 0 means that it does not display user prompts.
Session 0 occurs in the following scenarios:
- Installation during a Task Sequence.
- A Required deployment with the User Experience setting configured to install whether or not a user is logged on.
The solution to this problem is running ServiceUI.exe to bring the client out of session 0 and display the prompt. SeviceUI.exe is part of the Microsoft Deployment Toolkit and has been extracted for this purpose.
The Invoke-Installation.ps1 script automatically handles with session 0 issue.
Configure the Office 365 ProPlus solution with Powershell App Deployment Toolkit
Before you create the application, it requires you to make some customizations. The customizations include:
- Change the download XML
- Create configuration XML files
- Change the Deploy-Application.ps1 script file
- Change Offscrub behavior
- Configure different locales
- Change the banner
- Make customizations to Powershell Application Deployment Toolkit
Create a configuration for download of Office 365 ProPlus
To download the Office files, we need to create an XML file. Name it to download.xml or similar.
The contents should be something like this. Change the source path and any other parameters for your situation.
<Configuration> <Add SourcePath="D:\temp\files\Microsoft Office 365 ProPlusFiles" OfficeClientEdition="32"> <Product ID="O365ProPlusRetail" > <Language ID="en-US" /> </Product> </Add> </Configuration>
If you want to download more Languages, copy the <Language ID=”en-US”>/> and replace it with your language of choice. Copy the setup.exe and the XML to the Files folder of the solution.
Create deployment configuration for Office 365 ProPlus
To deploy Microsoft Office 365 ProPlus, there needs to be a configuration XML file for each language.
I have named the XML file for the English installation install_en-us.xml and the Swedish install_sv-se.xml.
You can create an XML file using this online tool: https://officedev.github.io/Office-IT-Pro-Deployment-Scripts/XmlEditor.html
Here is an example of the English version. Make the modifications for your organization:
<Configuration>
<Add Channel="Deferred" OfficeClientEdition="32" OfficeMgmtCOM="TRUE"> <Product ID="O365ProPlusRetail"> <Language ID="en-US" /> <ExcludeApp ID="Groove" /> </Product> </Add> <Display AcceptEULA="TRUE" Level="None" /> <Logging Level="Standard" /> <Property Value="1" Name="AUTOACTIVATE" /> <Property Value="FALSE" Name="FORCEAPPSHUTDOWN" /> <Property Value="0" Name="SharedComputerLicensing" /> <Property Value="FALSE" Name="PinIconsToTaskbar" /> <Updates Enabled="FALSE" /> </Configuration>
Create uninstall configuration for Office 365 ProPlus
Change the below XML file to fit your needs. If you want to uninstall several languages, you need to copy the Language ID line and add the new language.
<Configuration> <Display Level="None" AcceptEULA="True" /> <Property Name="FORCEAPPSHUTDOWN" Value="False" /> <Remove> <Product ID="O365ProPlusRetail"> <Language ID="en-us" /> </Product> </Remove> </Configuration>
Change the Deploy-Application.ps1 script file
You need to change the script file Deploy-Application.ps1 to use the XML files you have created.

Add the language code under
$LanguageMappingHT, besides the XML file for that language. Refer to this page for a full list of language codes.
Change to your organization’s banner
Replace AppDeployToolkitBanner.png in the AppDeployToolkit folder with your own.
Additional customizations in Powershell App Deployment Toolkit
Refer to AppDeployToolkitConfig.xml in the AppDeployToolkit folder
Download the files for Office 365 ProPlus
Download the Office 2016 Deployment Tool: https://www.microsoft.com/en-us/download/details.aspx?id=49117
Place the setup.exe file under /Files/.
Download Office 365 ProPlus
Launch an administrative command line prompt, or Powershell window and browse to /Files/
Execute the below command:
setup.exe /download download.xml

Because of the size (a few GBs), this might take a little while. Grab a coffee in the meantime.
When the download is complete, a folder called Office has been created, containing the latest version of Office 365 ProPlus. Place this under Files in the solution directory.

If you browse to the update path Files\Office\Data, you can see the build version, which can be useful to know when deploying different Update Channels. Go to https://docs.microsoft.com/en-us/officeupdates/update-history-office365-proplus-by-date for a full list of build numbers for Office 365 ProPlus.

Now everything is in place, and you need to create the application in Configuration Manager.
Deploy Office 365 ProPlus using Microsoft Endpoint Configuration Manager (SCCM)
Create the Office 365 ProPlus application
Create a new application via the Application Management page.

Select Manually specify the application information.

If required, specify information for the Application Catalog/Software Center.

Create Deployment Type
Press Add to create a new Deployment Type.

Select Manually specify the development type information. Make sure to select Script Installer above. If the default MSI option is selected, it impacts selections you can later make.

Give the Deployment Type a name and press Next.

Content source and installation/uninstallation programs
Configure according to the below table:
Setting | Value |
---|---|
Content location | Provide a UNC path to the Office 365 ProPlus source files |
Installation program | Invoke-Installation.ps1 |
Uninstall program | Deploy-Application.exe -DeploymentType "Uninstall" |

Create Detection Rules
Press Add Clause.

Setting | Value |
---|---|
Setting Type | Registry |
Hive | HKEY_LOCAL_MACHINE |
Key | Software\Microsoft\Windows\CurrentVersion\Uninstall\O365ProPlusRetail – en-us |
Use (Default) registry key value for detection | Checked |
Data Type | String |

Now you have added the Detection Rule for English.

If you include more languages in your deployment, you need to create a new Clause for each language and use an OR statement.
The installation returns an exit code failure if you do not configure this as System Center Configuration Manager (SCCM) does not detect the application.

Configure User Experience
Setting | Value |
---|---|
Installation behavior | Install for system |
Logon requirement | Whether or not a user is logged on |
Installation program visibility | Normal |

Press Next, Next and review the Summary.

Press Next to finalize the creation of the Deployment Type.
Press Next again to finalize the creation of the application.
Distribute content
Distribute the content to your Distribution Points.
Deploy to user/device collection
Deploy to collections.
End-user experience
Start the installation
Following deployment of the application, run a Policy Refresh on the client for it to appear in Software Center.

Press the icon and press Install in the next window.

If you have Microsoft Office applications open, you see this:

If you don’t have any Microsoft Office applications open, you are prompted with this:

Upon continuing, previous Microsoft Office versions are automatically uninstalled.

Following the uninstallation, the installation of Microsoft Office 365 ProPlus starts.

Troubleshoot the Office 365 ProPlus deployment using log files for Powershell App Deployment Toolkit
Logfile location: C:WindowsLogsSoftwareMicrosoft_Office365ProPlus_EN_01_PSAppDeployToolkit_Install
Conclusion
The Powershell Application Deployment Toolkit is an excellent tool to build upon when creating solutions such as for deploying Microsoft Office 365 ProPlus.
I hope that I have provided you with some help with your deployment project.
It took me some time to figures some of these things out.
If you have any comments or feedback, please drop a comment below.
Thanks!
References
- Powershell App Deployment Toolkit
- Microsoft Docs – Office 365 ProPlus Deployment
- Update history for Office 365 ProPlus (listed by date) | Microsoft Docs
Related posts
- How to configure maintenance windows in Microsoft Endpoint Configuration Manager (SCCM)
- How to configure collection updates in SCCM using Powershell
Hi Daniel,
Thanks for sharing this information it has been really helpful, I have followed the instructions and created the application and it notifies the user to close any open applications and uninstalls the previous version of office and sub components, however it never seems to proceed to the next step where it is meant to install O365, it displays a pop up reporting that the installation has been completed successfully, however O365 hasn’t installed? If I browse to the ccmcache folder all the files are present and if I run the O365 setup.exe file and point it to the install_en-us.xml file it proceeds to install without any problems. Any ideas why it might be failing to do the installation part of the deployment?
Hi Billy,
I am experiencing the same problem . Did you come across any solution for that. I hope Daniel will help us .
Hi,
Sorry for the late reply. Have you had a look in the log files under C:\Windows\Logs\Software ?
/Daniel
Hello,
Great article. This might be an obvious question but where do you find the Invoke-Installation.ps1 that you reference
Hi Michael,
Thanks for your comment. Invoke-Installation.ps1 is in the source files: http://www.danielclasson.com/wp-content/uploads/2018/02/Microsoft-Office-365-ProPlus-solution.zip
/Daniel
Hi Michael,
The Invoke-Installation.ps1 is part of the solution and should be in the zip file :).
/Daniel
When I set the deployment to required I keep getting a execution failed with exit code -1 from the Invoke-Installation.ps1 script.
If I run it manually from Software Center it works fine. If it is ran by itself with no user logged on it works fine. But if it runs by itself by a required deployment it does not work.
It doesn’t seem to containt the working directory or $CD variables?
[Installation] :: Executing [C:\WINDOWS\ccmcache\f\ServiceUI_x64.exe -process:explorer.exe Deploy-Application.exe]…
[Installation] :: Execution failed with exit code [-1].
Hi TJ,
If you run that command from the cache using Psexec, do you receive the same error?
/Daniel
Hei Daniel,
Thanks for the great article and tool!
I am experiencing the same error messages as TJ described.
I have attempted to run the command “ServiceUI_x64.exe -process:explorer.exe Deploy-Application.exe” as system via PSEXEC, and it worked as it should (installation warning poped up for the interactive user).
The log shows that this installation was started interactively:
[Initialization] :: Session 0 detected, process running in user interactive mode, user(s) logged in.
[Initialization] :: Installation is running in [Interactive] mode.
However, if application deployment cycle is triggered by sccm agent, the process is interpreted as non-interactive and fails:
[Initialization] :: Session 0 detected, process not running in user interactive mode; deployment mode set to [NonInteractive].
[Initialization] :: Installation is running in [NonInteractive] mode.
…
[Installation] :: Executing [C:\WINDOWS\ccmcache\c2\ServiceUI_x64.exe -process:explorer.exe Deploy-Application.exe]…
[Installation] :: Execution failed with exit code [-1].
Looks like I have found a workaround for the issue described – set Deployment Type > User Experience > Logon Requirement to Only when a user is logged on
Great! The only thing is that the solution then doesn’t work when deployed to a user who is not logged on or when run during a bare-metal installation. It was a while back ago I tested the solution, so I think I also will need to back and test :). Please let me know if you have any more information or have carried out additional tests. Thanks!
I know this is older, but I have this exact issue described by VA. I need this to run required during the day. Setting to Only when a user is logged on I still get the following:
[Initialization] :: Session 0 detected, process not running in user interactive mode; deployment mode set to [NonInteractive].
[Initialization] :: Installation is running in [NonInteractive] mode.
[Initialization] :: Deployment type is [Installation].
[Installation] :: A user is logged on. Running Interactive x64 installation.
[Installation] :: Executing [C:\WINDOWS\ccmcache\10\ServiceUI_x64.exe -process:explorer.exe Deploy-Application.exe]…
[Installation] :: Executing [C:\WINDOWS\ccmcache\10\ServiceUI_x64.exe -process:explorer.exe Deploy-Application.exe]…
[Installation] :: Execution failed with exit code [-1].
Hello Daniel.
How can i disable the Remaining referals.
Is there a way to add removing Microsoft Office Standard 2019 Click-to-Run version 1808 along with all the removal of office 2007-2016? I’ve got a few computers with this deployed already and would love to be able to remove the installs with this script instead of doing it manually.
Hi Kelvin,
Yes, that should be possible. I haven’t tested it out yet though :).
/Daniel
Hi,
May I know if you tried adding a proofing tool on your installation xml?
How did you handle the removal?
I was able to add but it has numerous entries on Program Features.
Thanks
Hi JB,
Sorry, I have not tried adding the proofing tool on my installation XML, so not really sure what the behavior will be.
/Daniel
Hello Daniel,
This is what I’ve been looking for to deploy O365 so thank you for the solution. The issue i’m facing is I want to install some apps after so I thought I give Application Groups a shot. Have you ran this process deploying with app groups? I’m getting the same issue as TJ & VA is having. Is it just because how app groups work at this time? It works fine deploying as a regular application and through the task sequence.
Hi,
Unfortunately, I have not tested using Application Groups for this solution. I will review and update the blog post to cover this.
Thanks!
/Daniel
Hi,
Has there been a solution to the errors mentioned by TJ and VA? I’m having those same issues.
is there an newer file with routine for uninstalling Office 2019 and Office 365 and then make it reinstall the Office pack ? (we are after a routine to install Office 365 Apps for Devices
Also interested to know if this could be updated to handle the removal of Office 2019 prior to installation?
Hi,
I know this is an old post but wondered if there has been a solutions/updates to the errors mentioned by TJ and VA? I’m having those same issues when trying to run the script whilst a user is logged on.
Running the same script with no user logged on (i.e. bare metal/OSD) works fine.