powershell app deployment toolkit

Introduction

There are many organizations 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.

The way described in this blog post is the way I go about deploying Office 365 ProPlus, and I have frankly not found a better way to do it.

If you have improvements to the process or any other ideas on how to do this better, please drop a comment 🙂

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.

Powershell App Deployment Toolkit

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 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 a XML configuration file, depending on the outcome.

powershell app deployment toolkit

In the default version of the 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 Office 365 ProPlus deployment solution in Microsoft Endpoint Configuration Manager (SCCM)

Download the Powershell App Deployment Toolkit solution

Download the Microsoft Office 365 ProPlus solution.

powershell app deployment toolkit

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 a XML file. Name it to download.xml or similar.

The contents should be something like this:

<Configuration> <Add SourcePath="D:tempfilesMicrosoft 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 a XML file using this online tool: https://officedev.github.io/Office-IT-Pro-Deployment-Scripts/XmlEditor.html

Here is the 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 there.

<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

Now you need to change the script file Deploy-Application.ps1 to use the XML files that you have created.

powershell app deployment toolkit

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 prompt and browse to /Files/

Execute the below command:

setup.exe /download download.xml
powershell app deployment toolkit

Because of the size (a few GBs), this might take a little while. Grab a coffee in the meantime.

When the download is complete, have a folder called Office. Place this under Files in the solution directory.

powershell app deployment toolkit

If you browse to FilesOfficeData 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.

office 365 deployment

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.

office 365 deployment

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 selected, it impacts selections you can later make.

Give the Deployment Type a name and press Next.

office 365 deployment

Content source and installation/uninstallation programs

Configure according to the below table:

SettingValue
Content locationProvide a UNC path to the Office 365 ProPlus source files
Installation programInvoke-Installation.ps1
Uninstall programDeploy-Application.exe -DeploymentType "Uninstall"
office 365 deployment

Create Detection Rules

Press Add Clause.

SettingValue
Setting TypeRegistry
Hive HKEY_LOCAL_MACHINE
KeySoftware\Microsoft\Windows\CurrentVersion\Uninstall\O365ProPlusRetail – en-us
Use (Default) registry key value for detectionChecked
Data TypeString

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.

office 365 deployment

Configure User Experience

SettingValue
Installation behaviorInstall for system
Logon requirementWhether or not a user is logged on
Installation program visibilityNormal
office 365 deployment

Press Next, Next and review the Summary.

office 365 deployment

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.

office 365 deployment

Press the icon and press Install in the next window.

office 365 deployment

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

powershell app deployment toolkit

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

powershell app deployment toolkit

Upon continuing, previous Microsoft Office versions are automatically uninstalled.

powershell app deployment toolkit

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

powershell app deployment toolkit

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 the deployment of 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

Related posts

Subscribe to newsletter:

If you want to receive the latest news for MEMCM, Windows 10, and Powershell, please subscribe to my monthly newsletter!

20 COMMENTS

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

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

      • 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!

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

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

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

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

LEAVE A REPLY

Please enter your comment!
Please enter your name here