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.
.intunewin as Detect. Complete the Intune Deployment Package for Detect first; this page adds three things on top: the AIWATCH_ENROLLMENT_KEY MSI property, the assert/ Intune Remediations pair (SYSTEM-context — enterprise hook install), and scripts/bootstrap.ps1 at user logon (user-context — per-user enroll).Prerequisites
- Intune admin with Win32 LOB app upload rights and Devices → Scripts and remediations → Remediations access (P2 or add-on).
- Devices running Windows 10 1809+ / 11, 64-bit, Microsoft Entra joined.
- A path for per-user logon scripts — Intune user-context Platform Script, GPO logon script, or SCCM Task Sequence step.
- An Enrollment Key minted in the Runlayer dashboard.
Creating an Enrollment Key
Creating an Enrollment Key
- Settings → Enrollment Keys tab → + Create Enrollment Key.
- Name it (e.g. “Production Intune — Enforce”).
- Copy the
rl_enroll_...value — it is shown only once.
What enforce adds to the Intune deployment
Theaiwatch-<version>-intune-package.zip already ships everything you need:
Path inside the .zip | Role | Privilege context | Schedule |
|---|---|---|---|
aiwatch-<version>-win-x64.intunewin | Win32 LOB app — installs aiwatch.exe + aiwatch-hook.exe + tenant registry | SYSTEM (per-machine) | once per device |
scan-on-detect/ or scheduled/ (pick one) | Detect remediation — runs aiwatch.exe scan | logged-on user | hourly (Intune min) |
assert/detect.ps1 + assert/remediate.ps1 | Enforce step 2 — runs aiwatch.exe setup hooks check/install --mdm to write enterprise hook configs under C:\ProgramData\Cursor\ + C:\Program Files\ClaudeCode\ | SYSTEM | hourly (Intune min) |
scripts/bootstrap.ps1 | Enforce step 1 — runs aiwatch.exe bootstrap --user (enroll + per-user hook configs) | logged-on user | once at first logon |
assert/*.ps1 short-circuits silently when AIWATCH_ENROLLMENT_KEY is unset (scan-only fleets pay zero hourly noise).
Deployment
Update the Win32 app install command
AIWATCH_ENROLLMENT_KEY (and optionally AIWATCH_USERNAME / AIWATCH_DEVICE_NAME):AIWATCH_ENFORCEMENT=0 (defaults to enforce when absent). All properties write to HKLM\Software\Runlayer\AIWatch\ as Host / OrgApiKey / EnrollmentKey / Username / DeviceName (REG_SZ) and Enforcement (REG_DWORD).Re-upload the Win32 app or push a Supersedence so the new install command propagates.Create the `assert/` Intune Remediation (SYSTEM)
- Name: e.g. “AI Watch Enforce — Assert Hooks”.
- Detection script: upload
assert/detect.ps1. - Remediation script: upload
assert/remediate.ps1. - Run this script using the logged-on credentials: No. Required — the scripts write SYSTEM-scoped paths under
Program Files/ProgramDataand refuse user context with exit 2. - Run script in 64-bit PowerShell host: Yes.
- Enforce script signature check: Yes for CI-built releases, No for local unsigned builds.
- Schedule: every 1 hour (Intune minimum). Both scripts are idempotent.
- Assign to the same device group as the Win32 app.
Wire `scripts/bootstrap.ps1` into a per-user logon trigger
assert/ pair will loop with exit 1 (no console-user credential) until the console user has run aiwatch.exe bootstrap --user at least once. Pick a user-context trigger so first-login users self-enroll automatically:- Intune user-context Platform Script
- GPO logon script
- SCCM Task Sequence
scripts/bootstrap.ps1 somewhere reachable (e.g. copied during MSI install). Then in Intune:- Devices → Scripts and remediations → Platform scripts → Add → Windows 10 and later.
- Upload
scripts/bootstrap.ps1. - Run this script using the logged on credentials: Yes.
- Run script in 64-bit PowerShell host: Yes.
- Assign to a user group covering everyone in the fleet.
bootstrap.ps1 refuses SYSTEM context with exit 2 — keep it off the Remediations pair, which must stay SYSTEM-only.Verification
On a test device after Intune sync, then a user logon:bootstrap.ps1 has fired).
Rotating the Enrollment Key
Push a new Win32 app install command with the updatedAIWATCH_ENROLLMENT_KEY (or a small Remediation that overwrites the registry value). The next bootstrap.ps1 run + next assert/ tick on each device picks up the new key. No .msi reinstall required if you only rewrite the registry.
Troubleshooting
`assert/` remediation loops at exit 1 (`no console-user credential`)
`assert/` remediation loops at exit 1 (`no console-user credential`)
aiwatch.exe bootstrap --user (or scripts/bootstrap.ps1) yet. Confirm the per-user logon trigger is in place — Intune user-context script, GPO logon, or SCCM. Once one user enrolls, the assert pair flips compliant on the next tick.`assert/` remediation marked **Failed** with `must run as SYSTEM, not the logged-on user` (exit 2)
`assert/` remediation marked **Failed** with `must run as SYSTEM, not the logged-on user` (exit 2)
`scripts/bootstrap.ps1` exits 2 with `must run as the logged-on user, not SYSTEM`
`scripts/bootstrap.ps1` exits 2 with `must run as the logged-on user, not SYSTEM`
assert/ pair, which handles enterprise hook configs.MSI install fails: `AIWATCH_HOST property is required` or `AIWATCH_ORG_API_KEY property is required`
MSI install fails: `AIWATCH_HOST property is required` or `AIWATCH_ORG_API_KEY property is required`
AIWATCH_HOST and AIWATCH_ORG_API_KEY are mandatory — the MSI’s Launch conditions refuse a half-configured registry write. Re-run with both set.`aiwatch.lazy_enrollment_fallback_hit` events in the dashboard
`aiwatch.lazy_enrollment_fallback_hit` events in the dashboard
aiwatch-hook fell back to self-enrolling because the user credential was missing when an AI client fired the hook. Self-healing — the device is fully provisioned after the first hook fire — but a non-zero rate means bootstrap.ps1 isn’t running reliably. Check the user-context logon trigger for that user / device.