Detect AI Tools on Windows with PDQ Inventory and PDQ Deploy
PDQ Inventory lists installed applications, and most AI coding tools install per user without registering as one. This free PowerShell scanner looks in every profile for Claude Code, Codex CLI, Cursor, Ollama, AI editor extensions and MCP configs, and returns rows you can filter, report and build collections on.
Why the applications scan misses them
Claude Code's native installer drops a single binary in %USERPROFILE%\.local\bin, Codex CLI and Gemini CLI usually arrive as global npm packages under %APPDATA%\npm, and Cursor or Windsurf install per user under %LOCALAPPDATA%\Programs. None of them needs an administrator, and several never appear in the applications list.
The PowerShell scanner in PDQ Inventory copies a script to each computer, runs it there and turns the objects it returns into a table: each property becomes a column and each object a row. That is a good fit for a per-tool inventory.
What the scanner 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.
The scanner script
Download kuntur-ai-inventory-pdq.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:
a295e18ddc4b6b6650614d35c7bc020231f1f2cfbb79335706e6416e6bb01705
Get-FileHash .\kuntur-ai-inventory-pdq.ps1 -Algorithm SHA256
The full script:
<#
Kuntur AI inventory - PDQ Inventory PowerShell scanner / PDQ Deploy step
https://kuntur.io/guides/pdq-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 (PDQ)
- Default: returns one object per finding with the same four columns
every time (Tool, Count, Users, Detail), which is what a PDQ Inventory
PowerShell scanner turns into rows. A clean device returns a single row
with Tool "(none)" so the scanner still records that it ran.
- -AsText: prints the one-line summary instead, for a PDQ Deploy
PowerShell step whose output you read in the deployment results.
- Always exits 0.
Runs on Windows PowerShell 5.1. Run it with an account that can read every
profile under C:\Users (Local System or a local administrator).
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,
# Print the one-line summary instead of objects (for PDQ Deploy).
[switch]$AsText
)
$ErrorActionPreference = 'SilentlyContinue'
Set-StrictMode -Version 2.0
$MaxOutput = 2000 # Used for the -AsText summary line.
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) + '...' }
if ($AsText) {
Write-Output $line
exit 0
}
$rows = @()
foreach ($name in $toolUsers.Keys) {
$u = @($toolUsers[$name] | Select-Object -Unique)
$detail = ''
if ($name -eq 'Ollama' -and $ollamaModels -gt 0) { $detail = ('{0} model manifests' -f $ollamaModels) }
if ($machineWide -contains $name) { $detail = (@($detail, 'also machine-wide') | Where-Object { $_ }) -join '; ' }
$rows += [PSCustomObject]@{ Tool = $name; Count = $u.Count; Users = ($u -join ','); Detail = $detail }
}
foreach ($m in ($machineWide | Select-Object -Unique)) {
if (-not $toolUsers.Contains($m)) { $rows += [PSCustomObject]@{ Tool = $m; Count = 0; Users = ''; Detail = 'machine-wide install' } }
}
if ($extCount -gt 0) {
$u = @($extUsers | Select-Object -Unique)
$rows += [PSCustomObject]@{ Tool = 'AI extensions'; Count = $u.Count; Users = ($u -join ','); Detail = ('{0} extension folders' -f $extCount) }
}
if ($mcpFiles -gt 0) {
$u = @($mcpUsers | Select-Object -Unique)
$rows += [PSCustomObject]@{ Tool = 'MCP configs'; Count = $u.Count; Users = ($u -join ','); Detail = ('{0} files, {1} servers' -f $mcpFiles, $mcpServers) }
}
if ($rows.Count -eq 0) {
$rows += [PSCustomObject]@{ Tool = '(none)'; Count = 0; Users = ''; Detail = ('{0} profiles checked' -f $profiles.Count) }
}
# No explicit exit here: the scanner collects these objects when the script ends.
$rows
By default it returns one object per finding with the same four columns every time: Tool, Count (profiles), Users and Detail. PDQ recommends always returning the same columns, so a clean computer returns a single row with Tool set to (none) rather than nothing. The -AsText switch prints the one-line summary instead, for PDQ Deploy.
Add it to PDQ Inventory
The PowerShell scanner needs PDQ Inventory in Enterprise mode.
- Create a new scan profile, or open an existing one under Scan Profiles, and add a scanner of type PowerShell.
- Name it Kuntur AI inventory. The scanner name is what you will pick in reports and collections, so keep it unique.
- Choose File and select
kuntur-ai-inventory-pdq.ps1. Leave Parameters empty. - Keep the default Row Limit of 100; the script returns at most about a dozen rows per computer.
- Run the profile against a few test computers, then add it to your scheduled scans.
The scan runs with the credentials PDQ Inventory uses for that computer. Use an account that is a local administrator on the targets, so the script can read every profile under C:\Users.
Read the results
On a computer's window, open the PowerShell page and pick the Kuntur AI inventory scanner to see its rows. For the fleet, build a report on the scanner's columns, or a dynamic collection with a filter such as Tool is not (none), which gives you a live list of machines with AI tools that updates on every scan.
Or run it from PDQ Deploy
Without Enterprise mode, or for a one-time sweep, add the script to a PDQ Deploy package as a PowerShell step with the parameter -AsText. The step output in the deployment results shows the one-line summary for each target, for example AI tools: Cursor(1), AI extensions(3 in 2) | users: alice,bob. Run the step as Local System or as a deploy user with local admin rights, not as the logged-on user.
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.
- Point in time. The scanner reports what existed at the last scan. A tool installed and removed between scans is missed.
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 | shThe scanner gives you rows per computer at each scan. The Kuntur agent is an MSI that installs silently with msiexec /qn, so a single PDQ Deploy package rolls it out to the same collections. 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
- CrowdStrike Falcon Real Time Response
- 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
- Does the PowerShell scanner need PDQ Inventory Enterprise?
- Yes, PDQ documents Enterprise mode as required for the PowerShell scanner and the PowerShell page. Without it, run the script from PDQ Deploy with
-AsText. - Why does a clean computer return a "(none)" row?
- PDQ recommends returning the same columns from every computer. A row with
Toolset to(none)records that the scan ran and found nothing, which is different from a computer that was never scanned. - Does the script collect secrets or file contents?
- No. It checks whether paths exist, counts model manifests and extension folders, and counts the server entries in MCP config files without reading their values. The output only contains tool names, counts and the user names of profiles where something was found.
- Does it find tools installed inside WSL?
- No. WSL distros keep their own file system, which this script does not open. Claude Code or Codex installed inside Ubuntu on WSL will not show up here.