# Install Microsoft 365 Fails with Exit Code 17006

> Fix a Company App or script whose Install Microsoft 365 PowerBrick fails with exit code 17006 because Office applications are open on the endpoint.

Source: https://docs.capaone.com/capaone/troubleshooting/install-microsoft-365-fails-with-exit-code-17006/  
Product: CapaOne — a separate CapaSystems product; do not apply this page to any other.

## Problem

A Company App or script that uses the
[Install Microsoft 365](/capaone/application-manager/powerbricks/bricks/install-microsoft-365/)
PowerBrick fails on some endpoints and works on others. The job fails with:

```text
ErrorCode: PACKAGE_FAILED_INSTALL (3329): The package <app name> failed (ExitCode: 17006)
Reason: Install_Microsoft_365: The exit code 17006 is not in the list of handled codes
```

`Install.log` for the job shows:

```text
setup.exe completed with exit code: 17006
ForceAppShutdown: False
```

To see the log, open the app, select the **Endpoints** tab, open the endpoint's row menu, and
select **View logs**. Open `Install.log`. On the endpoint, the log is in
`C:\ProgramData\CapaSystems\COA\Logs\PackageInstaller\<app name> <version>\`. See
[Read Installation Logs for Company Apps and Scripts](/capaone/troubleshooting/read-installation-logs-for-company-apps-and-scripts/).

## Cause

Exit code 17006 comes from Microsoft's Office Deployment Tool (`setup.exe`), not from CapaOne. It
means that Office applications were open on the endpoint, for example Outlook, Word, Excel,
OneNote, or classic Teams, and blocked the installation.

It happens most often when you install an extra Office product, such as Visio, Project, or
proofing tools, on top of an existing Microsoft 365 installation while a user is signed in and
working. Endpoints where the installation succeeds usually had no Office applications open.

**Force App Shutdown** is turned off by default in the Install Microsoft 365 PowerBrick, so the
brick doesn't close open Office applications.

## Solution

Use one of these options, then select **Redeploy** in the endpoint's row menu:

- **Turn on Force App Shutdown:** open the app, select **Edit**, and click
  **Open PowerBrick Editor**. Open the **Install Microsoft 365** brick, turn on
  **Force App Shutdown**, click **Apply changes**, click **Close**, and save the app. The Office
  Deployment Tool closes the Office applications that block the installation.
- **Install when Office is closed:** ask the users to close all Office applications, or install
  the app when no user is signed in.
- **Retry later automatically:** in the Install Microsoft 365 brick, add `17006` to
  **Return Code Handles** with **Retry Execution Later**. The job stops and runs again later
  instead of failing.

:::caution
**Force App Shutdown** closes the users' Office applications without asking them, and unsaved work
in them is lost. Tell the users first, or deploy outside working hours.
:::

## Good to know

- **A `Configuration.xml` in the app isn't used.** The brick builds its own Office Deployment Tool
  configuration, `Microsoft365_ODT_Config.xml`, from the brick's settings. Setting
  `FORCEAPPSHUTDOWN=TRUE` in an uploaded `Configuration.xml` has no effect. Use the brick's
  **Force App Shutdown** setting.
- **"Not in the list of handled codes" isn't a CapaOne error.** It means that `setup.exe` returned
  a code that the brick doesn't treat as success. By default, only `0` and `3010` count as success.
- **Missing files or licenses aren't the cause** when the same app works on other endpoints. The
  difference is almost always whether Office was running.

## When to contact support

If the installation still fails with exit code 17006 when all Office applications are closed,
contact support and attach these files from the job's log folder:

- `Install.log`
- `PackageInstaller.log`
- `CapaOne.ScriptingLibrary.log`
- `Microsoft365_ODT_Config.xml`

## Related

- [Install Microsoft 365](/capaone/application-manager/powerbricks/bricks/install-microsoft-365/)
- [Read Installation Logs for Company Apps and Scripts](/capaone/troubleshooting/read-installation-logs-for-company-apps-and-scripts/)
- [Assign and Redeploy Windows Applications](/capaone/application-manager/assign-and-redeploy-windows-applications/)
