> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Bach builds Windows installers from one bach.toml with the bach command: bach init, bach check, bach preview, bach build. Installs are per user and need no administrator rights by default. installer.scope = "machine" installs for every user after one Windows prompt. On Windows, run setup files with Start-Process -Wait -PassThru in PowerShell, and give signtool arguments that start with the word sign.

# bach intune: settings for Microsoft Intune

> bach intune FILE: writes the install and uninstall commands, the detection rule and a detection script that deploy a Bach setup file with Microsoft Intune.

`bach intune` writes down what Microsoft Intune, Configuration Manager or a similar tool needs to deploy a setup file that isn't an MSI: a silent install command, an uninstall command and a rule that says the app is installed. Bach already has all three. The command collects them, so you don't dig them out of the docs.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
bach intune dist/Hello-Setup-1.4.0.exe
```

| Argument or flag | Meaning |
| - | - |
| `FILE` | The setup file. An online installer or an uninstaller is refused. |
| `--out DIR`, `-o DIR` | Write the files into this folder. Default: `intune/<app id>` next to the setup file. |

## Output

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
Wrote the Intune settings for Hello 1.4.0 to dist\intune\Hello
  Install      Hello-Setup-1.4.0.exe --silent
  Uninstall    "%ProgramFiles%\Hello\uninstall.exe" --silent
  Run as       System (installs for every user)
  Detect       registry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Hello, DisplayVersion >= 1.4.0
  Requires     64-bit (x64), Windows 10 1809 or newer
```

The folder holds two files:

| File | What it holds |
| - | - |
| `intune.md` | The settings sheet: how to wrap the setup file with Microsoft's Win32 Content Prep Tool (`IntuneWinAppUtil.exe`), the program settings, the requirements and the detection rule, ready to copy into Intune. |
| `detect.ps1` | The same detection as a custom detection script. It reads the app's **Settings › Apps** entry and says "installed" when this version **or a newer one** is there, so Intune never installs an old version over one Bach has updated. Leave "Run script as 32-bit process" off. |

With `--json` the command prints `install_command`, `uninstall_command`, `run_as` (`system` or `user`), `detection_key` (machine-wide apps only) and `detection_script`.

## Machine-wide or per user

> [tab] Machine-wide
>
> Set [`installer.scope = "machine"`](/docs/guides/machine-wide-installs) for devices. Intune runs setup as the system account, so nothing asks for permission, and the registry rule works.

> [tab] Per user
>
> The default scope installs into the user's profile. Deploy it with install behavior **User**, to users rather than devices, and detect it with `detect.ps1`. The command warns about this.

## Notes

* The commands use the default install folder. If you install somewhere else with `--dir`, point the uninstall command there too.
* A version like `2.0.0-beta.1` isn't made of plain numbers, so Intune's registry rule can't compare it. The sheet then tells you to use `detect.ps1`.
* A setup file with [`[access]`](/docs/reference/config/access) needs its key: add `--key-file FILE` to the install command and put the key file in the package.
* Keep the app id and the scope the same in every release. Windows tells apps apart by them.
* The exit codes are the ones in [exit codes](/docs/reference/setup/exit-codes.md): `0` is success and `1` a failure, which are Intune's defaults too.

See also [Silent installs](/docs/guides/silent-installs.md) and [`bach winget`](/docs/reference/cli/winget).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.