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.

By Kuntur team · Published

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:

ToolWhere 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
CursorAppData\Local\Programs\cursor, .cursor, plus C:\Program Files\cursor
WindsurfAppData\Local\Programs\Windsurf, .windsurf, .codeium\windsurf
Claude DesktopAppData\Local\AnthropicClaude, AppData\Local\Programs\Claude, Store package Claude_*, AppData\Roaming\Claude
ChatGPT DesktopStore package OpenAI.ChatGPT-Desktop_*, AppData\Local\Programs\ChatGPT
OllamaAppData\Local\Programs\Ollama, .ollama; counts model manifests
LM StudioAppData\Local\Programs\LM Studio, .lmstudio
AI extensionsVS Code extension folders for GitHub Copilot, Claude Code, Continue, Cline, Roo Code, Kilo Code, Codeium, ChatGPT, Gemini Code Assist, Amazon Q and Tabnine
MCP configsclaude_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

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

  1. Upload kuntur-ai-inventory-crowdstrike-rtr.ps1 to the custom scripts library in the Falcon console (Response scripts and files), name it kuntur-ai-inventory, set the platform to Windows and choose who may run it.
  2. 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

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:

  1. Download scan.ps1.
  2. Read it. It's plain text; here's what it does.
  3. Check its SHA-256 against the published hash: Get-FileHash .\scan.ps1 -Algorithm SHA256
  4. Run it: powershell -ExecutionPolicy Bypass -File .\scan.ps1

Windows shortcut, if you trust the source (PowerShell)

irm https://app.kuntur.io/scan.ps1 | iex

macOS and Linux (Terminal)

curl -fsSL https://app.kuntur.io/scan.sh | sh

RTR 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.

More guides and tools:

FAQ

Which Falcon role can run this script?
RTR Administrator. runscript is 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.

Sources

  1. PSFalcon wiki: Real-time Response
  2. PSFalcon docs: Real-time response guide (permission levels)
  3. PSFalcon docs: RTR scripts (Send-FalconScript)
  4. PSFalcon docs: RTR automation examples