How to Find Claude Code and Codex CLI Running in WSL
Developers on Windows often install AI coding agents inside a WSL distro, not on Windows. Windows software inventory, the Start menu and most EDR app lists never see them. Here is how to find them.
Why WSL hides AI coding agents
Claude Code (@anthropic-ai/claude-code or the native installer) and Codex CLI (@openai/codex) are Linux programs when installed inside WSL. They live in the distro's own filesystem, inside a virtual disk, and do not appear in Programs and Features or the Windows registry. In WSL 2 their processes run inside a lightweight VM, so Task Manager shows the VM, not claude or codex.
They still run with the developer's permissions, can read the Windows drives mounted under /mnt/c, and launch MCP servers. That makes WSL the most common blind spot in AI tool inventories on Windows.
Step 1: list the WSL distros on a machine
WSL distros are registered per Windows user. Run this as the user, not as administrator or SYSTEM:
wsl.exe --list --verbose
The STATE column says whether each distro is running. The registry lists the same distros, with their disk location, without starting anything:
Get-ChildItem HKCU:\Software\Microsoft\Windows\CurrentVersion\Lxss |
ForEach-Object { Get-ItemProperty $_.PSPath } |
Select-Object DistributionName, BasePath, Version
Step 2: look for Claude Code and Codex inside a distro
From Windows, this runs a check inside one distro (replace Ubuntu). Note that it starts the distro if it is stopped, which users may notice:
wsl.exe -d Ubuntu -- bash -lc 'for b in claude codex; do command -v $b; done;
ls -d ~/.claude ~/.codex 2>/dev/null;
npm ls -g --depth=0 2>/dev/null | grep -E "claude-code|@openai/codex"'
What the results mean:
~/.local/bin/claudeor an npm global@anthropic-ai/claude-code: Claude Code is installed.~/.claudemeans it has been used.- A
codexbinary or@openai/codex: Codex CLI is installed.~/.codex/config.tomlholds its settings, including MCP servers under[mcp_servers.*].
For a running distro you can also read files from Windows through \\wsl.localhost\<distro>\home\<user> (\\wsl$\ on older builds) without executing anything inside it. Opening that path also starts a stopped distro.
Step 3: check the settings that matter
- Claude Code:
~/.claude/settings.jsonwith"defaultMode": "bypassPermissions"or broadBash(*)allow rules, and MCP servers in~/.claude.json. - Codex:
sandbox_mode = "danger-full-access"orapproval_policy = "never"in~/.codex/config.toml. - API keys exported in
~/.bashrcor~/.zshrc(ANTHROPIC_API_KEY,OPENAI_API_KEY): personal keys mean usage outside your company account.
Our Cursor and Claude Code security guide explains each of these and the admin controls the vendors ship.
Doing it across a fleet
This is where most scripts fail. Intune remediations and GPO scripts usually run as SYSTEM, and SYSTEM has no WSL distros: wsl.exe -l as SYSTEM returns nothing even when every developer has Ubuntu. You need to run in the user context (Intune: "Run this script using the logged-on credentials"), and you have to decide whether starting stopped distros on users' machines is acceptable.
Automate it
To check a single Windows machine without writing anything, run the free Kuntur scanner in PowerShell. It runs locally, needs no account or admin rights, and writes an HTML report to the Desktop. It does not upload results.
- Download scan.ps1.
- Read it. It's plain text; here's what it does.
- Check its SHA-256 against the published hash:
Get-FileHash .\scan.ps1 -Algorithm SHA256 - Run it:
powershell -ExecutionPolicy Bypass -File .\scan.ps1
Windows shortcut, if you trust the source (PowerShell)
irm https://app.kuntur.io/scan.ps1 | iexYou can download and read the script first; what it does is documented.
The Kuntur agent handles WSL on its own: it inventories every registered distro per user from the registry, scans running distros from the host through the distro share with the regular Linux collectors (no command runs inside the distro), and reports stopped distros as inventory only, without starting them. Claude Code, Codex and other tools found inside a distro are reported with the distro name. Kuntur does not block or remove anything. See what Kuntur detects.
FAQ
- Does Claude Code in WSL show up in Windows installed programs?
- No. It is installed inside the Linux distro, so it is not in Programs and Features or the Windows registry. You have to look inside the distro or read its filesystem through \\wsl.localhost.
- Why does my Intune script find no WSL distros?
- WSL distros are registered per user. A script running as SYSTEM sees none. Run the detection in the logged-on user context.
- Does checking a distro start it?
- Yes. Both wsl.exe -d <distro> and opening \\wsl.localhost\<distro> start a stopped distro. The registry key HKCU\Software\Microsoft\Windows\CurrentVersion\Lxss lists distros without starting them.
Sources
- Microsoft Learn: Basic commands for WSL
- Microsoft Learn: Working across Windows and Linux file systems
- Claude Code docs: Set up Claude Code
- Claude Code docs: Settings
- OpenAI Codex CLI (GitHub)
More guides: