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

# Intune Deployment (Windows)

> Deploy the Runlayer CLI to Windows devices as an Intune Win32 app

The Windows package is an Authenticode-signed MSI wrapped for Intune. It installs per-machine into `C:\Program Files\Runlayer\CLI\`, adds that directory to the system `PATH`, and registers two SYSTEM scheduled tasks: the hourly `\Runlayer\CLIUpdate` updater and the `\Runlayer\CLISchedule` per-user scheduler that delivers managed skill sync. The MSI takes no tenant properties. Optional managed-update and skill-sync settings come from the registry after installation or fall back to an existing AI Watch configuration.

## Prerequisites

* Microsoft Intune admin access
* Windows x64 devices
* The Authenticode-signed `runlayer-<version>-win-x64.intunewin` from your Runlayer downloads access

## Deployment Steps

**1. Upload the .intunewin**

Upload `runlayer-<version>-win-x64.intunewin` as a **Win32 app** in Intune.

**2. Set install and uninstall commands**

```text Install theme={null}
msiexec /i runlayer-<version>-win-x64.msi /qn /norestart
```

```text Uninstall theme={null}
msiexec /x runlayer-<version>-win-x64.msi /qn /norestart
```

Set **Device restart behavior** to **No specific action**. Without `/norestart`, a quiet uninstall can reboot the device with no warning (exit code `1641`).

**3. Set the detection rule**

Use a **file** detection rule that compares the file version, so Intune detects upgrades correctly instead of treating any installed build as current:

| Field | Value |
| - | - |
| Rule type | File |
| Path | `C:\Program Files\Runlayer\CLI\` |
| File | `runlayer.exe` |
| Detection method | String (version) |
| Operator | Greater than or equal to |
| Value | The packaged version as a four-part file version — the release padded to `major.minor.patch.0` (e.g. `1.2.3` ships as `1.2.3.0`) |

A bare "file exists" rule reports the app installed even when an older build is present, so Intune never pushes the upgrade. Comparing the file version string fixes that. Alternatively, detect the registry value `HKLM\Software\Runlayer\CLI\InstallDir`.

**4. Deploy in System context**

The MSI installs per-machine, so assign the app to run in **System** context.

> [!NOTE]
>
> Because the installer updates the **system** `PATH`, already-open terminals won't see `runlayer` until they are restarted (or the device is rebooted). New shells resolve it immediately.

## Managed configuration (optional)

For the full CLI, configure managed values under `HKLM\Software\Runlayer\CLI`. Intune has no built-in setting for custom registry keys, so deploy them as a platform script: **Devices** → **Scripts and remediations** → **Platform scripts** → **Add** → **Windows 10 and later**, with **Run this script using the logged on credentials** = **No** and **Run script in 64-bit PowerShell host** = **Yes**, assigned to a device group that contains the app's devices (Intune ignores user-group assignments on workplace-joined devices):

```powershell theme={null}
reg add "HKLM\Software\Runlayer\CLI" /v Host /t REG_SZ /d "https://<your-host>.runlayer.com" /f /reg:64
reg add "HKLM\Software\Runlayer\CLI" /v OrgApiKey /t REG_SZ /d "rl_org_..." /f /reg:64
```

`/reg:64` keeps the values in the 64-bit registry view the CLI reads, even if the script runs in a 32-bit host. The CLI reads that key first and fills any missing values from `HKLM\Software\Runlayer\AIWatch`, so devices already running [AI Watch](https://docs.runlayer.com/shadow-ai/deploy.md) can reuse its host and organization API key.

| Value | Type | Default | Purpose |
| - | - | - | - |
| `InstallDir` | `REG_SZ` | Written by the MSI | Installed CLI directory; also usable for Intune detection |
| `Host` | `REG_SZ` | None | Tenant URL required for managed updates and skill sync |
| `OrgApiKey` | `REG_SZ` | None | Organization API key required for managed updates and used as the skill-sync fallback |
| `SkillSyncOrgApiKey` | `REG_SZ` | None | Optional dedicated key with the **Skill Sync** role |
| `SyncSkills` | `REG_DWORD` | `1` | Set `0` to disable managed skill reconciliation |
| `Username` | `REG_SZ` | Current user | Optional user identity override for skill sync |

You do not need to duplicate values already present under the AI Watch key. A value under the CLI key takes precedence over the corresponding AI Watch value.

## Automatic updates

The MSI registers the hidden, protected `\Runlayer\CLIUpdate` task during installation. It checks for updates as SYSTEM about two minutes after registration, then every hour. Host and credentials stay in the registry and never appear in the task arguments.

The task silently exits unless `Host` and `OrgApiKey` resolve from the CLI or AI Watch registry key. When they are present, automatic updates are always on and install the CLI version selected by your Runlayer tenant. Pin a CLI version in Client Updates to hold it. For a one-off update, run `runlayer update` from an elevated terminal with an organization API key.

## Automatic skill sync

The MSI registers `\Runlayer\CLISchedule`, a protected SYSTEM task that runs hourly and whenever any user logs on. The task runs `runlayer schedule` in each logged-on user's context, so managed skills are written as that user rather than as SYSTEM. It delivers skills only. Connectors and plugins with **Sync to devices** turned on still need a scheduled `runlayer setup sync --yes`; see [Keep connectors in sync](https://docs.runlayer.com/auto-provisioning.md#keep-connectors-in-sync).

The scheduler resolves the managed `Host`, `SkillSyncOrgApiKey` (or `OrgApiKey`), and `SyncSkills` values described in [Managed configuration](#managed-configuration-optional). Without a managed host and key it exits quietly. Set `SyncSkills=0` to disable managed skill delivery. See [Sync to devices](https://docs.runlayer.com/platform-skills.md#sync-to-devices).

Only users logged on when a task fires are synced. The any-user logon trigger catches a returning user immediately; the hourly trigger converges users who remain logged on.

To run the same per-user sync immediately instead of waiting for a trigger, run `runlayer schedule --all-users` from an elevated terminal — it performs one pass as each logged-on user, exactly like the scheduled task.

## Upgrades and removal

* **Automatic upgrade** — with managed `Host` and `OrgApiKey` values, `CLIUpdate` installs the version selected by your Runlayer tenant on its hourly tick. Pin a CLI version in Client Updates to hold it.
* **Intune upgrade** — push the newer `.msi` / `.intunewin` through the same Intune app; the MSI uses a major-upgrade, so it upgrades in place.
* **Remove** — unassign the app in Intune, or run `msiexec /x runlayer-<version>-win-x64.msi /qn /norestart` on the device. The uninstall also removes the `\Runlayer\CLIUpdate` and `\Runlayer\CLISchedule` scheduled tasks; there are no profiles to clean up.

## Verification

Monitor install status in the Intune admin center under the app's device and user install report. On a target device, open a **new** terminal (so it picks up the updated `PATH`) and confirm the binary resolves:

```bash theme={null}
runlayer --version
runlayer status
```

In Task Scheduler, confirm `\Runlayer\CLIUpdate` and `\Runlayer\CLISchedule` are present. `CLISchedule`'s **Last Run Result** reports task-level failures; per-user sync status is shown on the device page in Runlayer.


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