Detect AI Tools on Windows with CrowdStrike Real Time Response
If Falcon is on every Windows machine, Real Time Response can answer "which AI tools are installed here" without another agent. This free script runs with runscript, looks in every profile for Claude Code, Codex CLI, Cursor, Ollama, AI editor extensions and MCP configs, and returns one line of JSON per host.
Why use RTR for this
Most AI coding tools install into the user's profile without admin rights: Claude Code's native installer uses %USERPROFILE%\.local\bin, Codex CLI and Gemini CLI arrive through npm, and Cursor installs per user. Software inventory that relies on installed programs rarely lists them.
Real Time Response runs commands as SYSTEM on hosts that already have the Falcon sensor, which makes it a quick way to sweep a host group during an investigation or an audit. It is a point-in-time sweep, not runtime protection; AIDR vs AI inventory explains how the two differ. The script is read-only and writes nothing to disk, so it suits an incident-response context.
What the script checks
The paths come from the same detection catalog the Kuntur agent and the Intune script use. For every profile under C:\Users (skipping Public, Default and system profiles) it checks:
| Tool | Where it looks (per profile) |
|---|---|
| Claude Code | .local\bin\claude.exe, .claude, npm @anthropic-ai/claude-code |
| Codex CLI | .codex, npm @openai/codex |
| Gemini CLI | .gemini, AppData\Roaming\npm\gemini.cmd, npm @google/gemini-cli |
| Cursor | AppData\Local\Programs\cursor, .cursor, plus C:\Program Files\cursor |
| Windsurf | AppData\Local\Programs\Windsurf, .windsurf, .codeium\windsurf |
| Claude Desktop | AppData\Local\AnthropicClaude, AppData\Local\Programs\Claude, Store package Claude_*, AppData\Roaming\Claude |
| ChatGPT Desktop | Store package OpenAI.ChatGPT-Desktop_*, AppData\Local\Programs\ChatGPT |
| Ollama | AppData\Local\Programs\Ollama, .ollama; counts model manifests |
| LM Studio | AppData\Local\Programs\LM Studio, .lmstudio |
| AI extensions | VS Code extension folders for GitHub Copilot, Claude Code, Continue, Cline, Roo Code, Kilo Code, Codeium, ChatGPT, Gemini Code Assist, Amazon Q and Tabnine |
| MCP configs | claude_desktop_config.json, .claude.json, .cursor\mcp.json, Windsurf mcp_config.json, .gemini\settings.json, .lmstudio\mcp.json, VS Code mcp.json; counts server entries |
It never prints file contents. For MCP configs it counts the entries under mcpServers (or servers for VS Code) without reading their commands, URLs or environment variables, which is where tokens tend to live.
Requirements
runscriptis an RTR admin command. You need the Real Time Response Administrator role (the API scope is Real time response (admin) write); Read Only Analyst and Active Responder cannot run it.- Real Time Response must be enabled for the hosts in their response policy.
- For the fleet run below, an API client with the RTR scopes and PSFalcon, CrowdStrike's PowerShell module.
The script
Download kuntur-ai-inventory-crowdstrike-rtr.ps1 and read it before you upload it. It is read-only, makes no network calls and works on Windows PowerShell 5.1. Check the file against this SHA-256:
59bd7583bb2a4c033626663b08328d40ffb4cce26cc3d74b62eec5bb5290b634
Get-FileHash .\kuntur-ai-inventory-crowdstrike-rtr.ps1 -Algorithm SHA256
The full script:
<#
Kuntur AI inventory - CrowdStrike Falcon Real Time Response (runscript)
https://kuntur.io/guides/crowdstrike-rtr-detect-ai-tools
What it does
Looks in every user profile on the device for AI coding tools, AI desktop
apps, local model runners, AI editor extensions and MCP server configs.
Read-only. No network. Never prints file contents or secrets: only tool
names, counts and the user names that have something installed.
Same detection catalog as the Kuntur Intune and NinjaOne scripts.
Output and exit code (Real Time Response)
- Prints ONE line of compact JSON to stdout, so results from many hosts
(PSFalcon, Falcon Fusion workflows or the API) are easy to parse:
{"host":...,"found":true,"profiles":N,"summary":"AI tools: ...",
"tools":{...},"machine_wide":[...],"ollama_models":N,
"ai_extensions":N,"mcp_config_files":N,"mcp_servers":N}
- Always exits 0.
Runs on Windows PowerShell 5.1 as SYSTEM (how RTR runs commands), which can
read every profile under C:\Users. Nothing is written to disk.
Kuntur, November 2026. MIT licence.
#>
param(
# Folder that holds the user profiles.
[string]$ProfileRoot = $(if ($env:SystemDrive) { Join-Path $env:SystemDrive 'Users' } else { 'C:\Users' }),
# Where machine-wide installs live. Empty skips the machine-wide check.
[string]$ProgramFilesRoot = $env:ProgramFiles
)
$ErrorActionPreference = 'SilentlyContinue'
Set-StrictMode -Version 2.0
$MaxOutput = 2000 # Keeps the summary field compact.
function Join-Parts([string]$Base, [string[]]$Parts) {
$p = $Base
foreach ($part in $Parts) { $p = Join-Path $p $part }
return $p
}
function Test-AnyPath([string]$Base, [object[]]$Candidates) {
foreach ($c in $Candidates) {
$full = Join-Parts $Base ([string[]]$c)
if (Test-Path -Path $full) { return $true }
}
return $false
}
function Count-McpServers([string]$File, [string]$Key) {
# Counts server entries under a JSON key. Reads names only, never values.
try {
$raw = Get-Content -LiteralPath $File -Raw -ErrorAction Stop
$json = $raw | ConvertFrom-Json -ErrorAction Stop
} catch { return 0 }
$n = 0
$node = $json.PSObject.Properties[$Key]
if ($node -and $node.Value) { $n += @($node.Value.PSObject.Properties).Count }
$projects = $json.PSObject.Properties['projects'] # ~/.claude.json keeps per-project servers
if ($projects -and $projects.Value) {
foreach ($proj in $projects.Value.PSObject.Properties) {
$inner = $proj.Value.PSObject.Properties[$Key]
if ($inner -and $inner.Value) { $n += @($inner.Value.PSObject.Properties).Count }
}
}
return $n
}
# Tool definitions: each candidate is a list of path segments under the profile.
$Tools = [ordered]@{
'Claude Code' = @( @('.local','bin','claude.exe'), @('.claude'), @('AppData','Roaming','npm','node_modules','@anthropic-ai','claude-code') )
'Codex CLI' = @( @('.codex'), @('AppData','Roaming','npm','node_modules','@openai','codex') )
'Gemini CLI' = @( @('.gemini'), @('AppData','Roaming','npm','gemini.cmd'), @('AppData','Roaming','npm','node_modules','@google','gemini-cli') )
'Cursor' = @( @('AppData','Local','Programs','cursor'), @('.cursor') )
'Windsurf' = @( @('AppData','Local','Programs','Windsurf'), @('.windsurf'), @('.codeium','windsurf') )
'Claude Desktop' = @( @('AppData','Local','AnthropicClaude'), @('AppData','Local','Programs','Claude'), @('AppData','Local','Packages','Claude_*'), @('AppData','Local','Packages','AnthropicPBC.Claude*'), @('AppData','Roaming','Claude') )
'ChatGPT Desktop'= @( @('AppData','Local','Packages','OpenAI.ChatGPT-Desktop_*'), @('AppData','Local','Programs','ChatGPT') )
'Ollama' = @( @('AppData','Local','Programs','Ollama'), @('.ollama') )
'LM Studio' = @( @('AppData','Local','Programs','LM Studio'), @('AppData','Local','Programs','lm-studio'), @('.lmstudio') )
}
$ExtensionPatterns = @(
'github.copilot-*', 'github.copilot-chat-*', 'anthropic.claude-code-*', 'continue.continue-*',
'saoudrizwan.claude-dev-*', 'rooveterinaryinc.roo-cline-*', 'kilocode.kilo-code-*', 'codeium.codeium-*',
'openai.chatgpt-*', 'google.geminicodeassist-*', 'amazonwebservices.amazon-q-vscode-*', 'tabnine.tabnine-vscode-*'
)
# MCP config files and the JSON key that lists servers.
$McpConfigs = @(
@{ Parts = @('AppData','Roaming','Claude','claude_desktop_config.json'); Key = 'mcpServers' },
@{ Parts = @('.claude.json'); Key = 'mcpServers' },
@{ Parts = @('.cursor','mcp.json'); Key = 'mcpServers' },
@{ Parts = @('.codeium','windsurf','mcp_config.json'); Key = 'mcpServers' },
@{ Parts = @('.gemini','settings.json'); Key = 'mcpServers' },
@{ Parts = @('.lmstudio','mcp.json'); Key = 'mcpServers' },
@{ Parts = @('AppData','Roaming','Code','User','mcp.json'); Key = 'servers' }
)
$SkipProfiles = @('Public','Default','Default User','All Users','WDAGUtilityAccount','defaultuser0','DefaultAppPool')
$toolUsers = [ordered]@{} # tool name -> list of users
$ollamaModels = 0
$extCount = 0; $extUsers = @()
$mcpFiles = 0; $mcpServers = 0; $mcpUsers = @()
$usersWithAI = @()
$profiles = @(Get-ChildItem -LiteralPath $ProfileRoot -Directory -Force | Where-Object {
($SkipProfiles -notcontains $_.Name) -and ($_.Name -notlike '.*') -and ($_.Name -notlike 'defaultuser*')
})
foreach ($prof in $profiles) {
$home_ = $prof.FullName
$user = $prof.Name
$hit = $false
foreach ($name in $Tools.Keys) {
if (Test-AnyPath $home_ $Tools[$name]) {
if (-not $toolUsers.Contains($name)) { $toolUsers[$name] = @() }
$toolUsers[$name] += $user
$hit = $true
}
}
$manifests = Join-Parts $home_ @('.ollama','models','manifests')
if (Test-Path -LiteralPath $manifests) {
$ollamaModels += @(Get-ChildItem -LiteralPath $manifests -Recurse -File -Force).Count
}
$extDir = Join-Parts $home_ @('.vscode','extensions')
if (Test-Path -LiteralPath $extDir) {
$extFound = @(Get-ChildItem -LiteralPath $extDir -Directory -Force | Where-Object {
$n = $_.Name.ToLowerInvariant(); $m = $false
foreach ($pat in $ExtensionPatterns) { if ($n -like $pat) { $m = $true; break } }
$m
})
if ($extFound.Count -gt 0) { $extCount += $extFound.Count; $extUsers += $user; $hit = $true }
}
$userMcp = $false
foreach ($cfg in $McpConfigs) {
$f = Join-Parts $home_ ([string[]]$cfg.Parts)
if (Test-Path -LiteralPath $f -PathType Leaf) {
$servers = Count-McpServers $f $cfg.Key
if ($servers -gt 0) { $mcpFiles++; $mcpServers += $servers; $userMcp = $true }
}
}
if ($userMcp) { $mcpUsers += $user; $hit = $true }
if ($hit) { $usersWithAI += $user }
}
# Machine-wide installs (all users).
$machineWide = @()
if ($ProgramFilesRoot) {
foreach ($p in @(
@{ Name = 'Cursor'; Path = (Join-Path $ProgramFilesRoot 'cursor') },
@{ Name = 'Ollama'; Path = (Join-Path $ProgramFilesRoot 'Ollama') })) {
if (Test-Path -LiteralPath $p.Path) { $machineWide += $p.Name }
}
}
$parts = @()
foreach ($name in $toolUsers.Keys) {
$n = @($toolUsers[$name] | Select-Object -Unique).Count
if ($name -eq 'Ollama' -and $ollamaModels -gt 0) { $parts += ('{0}({1}; {2} models)' -f $name, $n, $ollamaModels) }
else { $parts += ('{0}({1})' -f $name, $n) }
}
foreach ($m in ($machineWide | Select-Object -Unique)) {
if (-not $toolUsers.Contains($m)) { $parts += ('{0}(machine)' -f $m) }
}
if ($extCount -gt 0) { $parts += ('AI extensions({0} in {1})' -f $extCount, @($extUsers | Select-Object -Unique).Count) }
if ($mcpFiles -gt 0) { $parts += ('MCP configs({0}; {1} servers)' -f $mcpFiles, $mcpServers) }
$found = $parts.Count -gt 0
if ($found) {
$line = 'AI tools: ' + ($parts -join ', ')
$userList = @($usersWithAI | Select-Object -Unique)
if ($userList.Count -gt 0) { $line += ' | users: ' + ($userList -join ',') }
} else {
$line = 'AI tools: none found in ' + $profiles.Count + ' profiles'
}
if ($line.Length -gt $MaxOutput) { $line = $line.Substring(0, $MaxOutput - 3) + '...' }
$tools = [ordered]@{}
foreach ($name in $toolUsers.Keys) { $tools[$name] = @($toolUsers[$name] | Select-Object -Unique) }
$result = [ordered]@{
host = $env:COMPUTERNAME
collected_utc = (Get-Date).ToUniversalTime().ToString('o')
found = $found
profiles = $profiles.Count
summary = $line
tools = $tools
machine_wide = @($machineWide | Select-Object -Unique)
ollama_models = $ollamaModels
ai_extensions = $extCount
mcp_config_files = $mcpFiles
mcp_servers = $mcpServers
}
Write-Output ($result | ConvertTo-Json -Depth 4 -Compress)
exit 0
It prints one line of compact JSON, so results from hundreds of hosts can be parsed without regular expressions, and it always exits 0. The summary field holds the same one-line text the other versions print.
Run it on one host
- Upload
kuntur-ai-inventory-crowdstrike-rtr.ps1to the custom scripts library in the Falcon console (Response scripts and files), name itkuntur-ai-inventory, set the platform to Windows and choose who may run it. - Open an RTR session on the host and run:
runscript -CloudFile="kuntur-ai-inventory"
On a machine with many large profiles, add a longer -Timeout value to the command if it times out.
Run it across a host group
With PSFalcon, upload the script once and run it on a host group, queueing it for hosts that are offline:
Send-FalconScript -Path .\kuntur-ai-inventory-crowdstrike-rtr.ps1 -Platform windows -PermissionType group -Name kuntur-ai-inventory
Invoke-FalconRtr -Command runscript -Argument '-CloudFile="kuntur-ai-inventory"' -GroupId <host_group_id> -QueueOffline $true |
Export-Csv .\kuntur-ai-inventory.csv -NoTypeInformation
-PermissionType group lets every RTR Administrator run the script; private keeps it to you. Parameter names follow the current PSFalcon release; check Get-Help Invoke-FalconRtr if your version differs. If your subscription includes Falcon Fusion workflows, the same custom script can run on a schedule from a workflow instead.
Read the results
Each row of the CSV has the host and the script's stdout. Turn the JSON into a table:
Import-Csv .\kuntur-ai-inventory.csv | Where-Object stdout |
ForEach-Object { $_.stdout | ConvertFrom-Json } |
Select-Object host, found, profiles, mcp_servers, summary |
Sort-Object found -Descending | Format-Table -AutoSize
Hosts that were queued offline return results when they come back online; run the export again later to collect them.
What it does not see
- WSL distros. Tools installed inside Ubuntu on WSL live in the distro's own file system. See How to find Claude Code and Codex CLI running in WSL.
- Docker containers and VMs. Images and guests have their own file systems. See AI in Docker containers.
- Browser AI. ChatGPT, Claude or Gemini used in a browser tab leave no install. Browser extensions are a separate check; see AI browser extensions audit.
- Use versus install. A folder like
.claudeshows the tool was set up, not that it was used last week. - Unknown tools. It checks a fixed list. A new CLI that nobody has added yet will not show up.
- Other editors. Extension checks cover VS Code's default folder; JetBrains IDEs, VS Code Insiders and forks keep extensions elsewhere.
- Secrets. It counts MCP servers but deliberately does not look inside them, so it cannot tell you which ones hold a plaintext token. See Find AI API keys on employee laptops for a masked check.
- Windows only. This is PowerShell. For Macs, the logic in the Jamf script runs in a shell and can be adapted for RTR on macOS.
- Point in time. It reports what existed when the command ran.
Do it continuously across the fleet
To check one machine by hand first, the free Kuntur scanner lists the same tools on that computer and writes an HTML report:
- 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 | iexmacOS and Linux (Terminal)
curl -fsSL https://app.kuntur.io/scan.sh | shRTR is ideal for a sweep, but it is a manual, privileged action. The Kuntur agent is an MSI that installs silently with msiexec /qn through your MDM or RMM and keeps the inventory current without RTR sessions. The Kuntur agent reports a full inventory from every device: the tool, version, which user, whether it runs on the host, in WSL, in a container or a VM, MCP servers with their risky settings, and local models. It catches tools that are not on any fixed list through network and runtime signals, and you mark each one approved or unauthorized for the whole organization.
Free for up to 5 endpoints. Pro is US$3 per endpoint per month (or US$30 per endpoint per year) for 10 to 30 endpoints. The trial needs no credit card. Kuntur detects and reports; it does not block or uninstall anything.
The same inventory in other tools
The detection catalog is the same in every version; only the way each tool runs the script and shows its output changes.
- Microsoft Intune (Remediations)
- Configuration Manager (SCCM)
- Workspace ONE UEM (sensor)
- NinjaOne
- Datto RMM
- ConnectWise Automate
- PDQ Inventory and PDQ Deploy
- Jamf Pro (macOS)
- Iru, formerly Kandji (macOS)
More guides and tools:
- How to detect Claude Code on company laptops
- Inventory MCP servers across your fleet
- Find AI API keys on employee laptops
- Kuntur compared with other Shadow AI tools
- All guides
FAQ
- Which Falcon role can run this script?
- RTR Administrator.
runscriptis an admin-level RTR command, so Read Only Analyst and Active Responder cannot run it. - Does the script write anything to the host?
- No. It only reads paths and MCP config key names and prints one line of JSON to stdout. Nothing is written to disk and nothing is sent over the network.
- Does the script collect secrets or file contents?
- No. It counts the server entries in MCP config files without reading their commands, URLs or environment variables. The output contains tool names, counts and the user names of profiles where something was found.
- Can it see tools inside WSL or containers?
- No. WSL distros and containers have their own file systems, which this script does not open.