> ## 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

> bach intune writes the install and uninstall commands, detection rule and detection script that Microsoft Intune needs for your setup file.

Microsoft Intune needs to know how to install and remove an app and how to tell it's installed. `bach intune` writes that down from your setup file.

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

| Argument or flag | Meaning |
| - | - |
| `FILE` | The full setup file |
| `-o`, `--out DIR` | Default `intune/<app id>` next to the setup file |

```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
```

It writes:

* `intune.md`: how to wrap the file with Microsoft's Win32 Content Prep Tool and what to enter in Intune
* `detect.ps1`: a detection script that counts this version or a newer one as installed, so Intune doesn't downgrade apps that updated themselves. Leave "Run script as 32-bit process" off.

## Per user or machine-wide

For deployment to devices, use `installer.scope = "machine"`; Intune runs setup as SYSTEM. A per-user app is deployed to users with install behavior **User** and detected with `detect.ps1`.

## Notes

* Commands assume the default folder; adjust the uninstall command if you use `--dir`.
* A version like `2.0.0-beta.1` can't be compared by Intune's registry rule; use the script.
* Apps with an access key need `--key-file` in the install command, with the key file in the package.

With `--json`: `install_command`, `uninstall_command`, `run_as`, `detection_key`, `detection_script`.


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