Detect AI Tools on Windows with Configuration Manager (SCCM)
Configuration Manager inventories what is registered in Programs and Features, and most AI coding tools never register there. This free script runs through Run Scripts for an answer in minutes, or as a configuration item for a daily compliance view, and reports one line per device.
Why hardware inventory misses them
Installed software in Configuration Manager comes from what Windows registers as installed programs. 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 Programs and Features.
Software inventory can collect files by name, but you would have to list every path for every profile and wait for the inventory cycle. A short PowerShell script that knows where these tools live is faster to run and easier to read.
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
- Run Scripts needs the Create and Run Scripts feature turned on (Administration › Updates and Servicing › Features), clients from version 1706 or later, and PowerShell 3.0 or later on the client.
- The Script Authors, Script Approvers and Script Runners security roles are not created by default. Microsoft documents the permissions each one needs; an account with Full Administrator can do all three.
- By default a script author cannot approve their own script (the hierarchy setting Script authors require additional script approver). Plan for a second person, or change the setting only in a lab.
- Scripts run as the computer account (Local System), which can read every profile under
C:\Users. Run Scripts keeps only 4 KB of output, which is why the script prints one compact line.
The script
Download kuntur-ai-inventory-sccm.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:
dd6668ff8381330a2cbcb71e27a2169740238158179b716f316699fb4b367d57
Get-FileHash .\kuntur-ai-inventory-sccm.ps1 -Algorithm SHA256
The full script:
<#
Kuntur AI inventory - Configuration Manager (Run Scripts or configuration item)
https://kuntur.io/guides/sccm-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 (Configuration Manager)
- Prints ONE line of text, well under the 4 KB that Run Scripts keeps.
It starts with "AI tools: none found" on a clean device.
- Always exits 0, so Script Status shows a clean run and a configuration
item never reports a script error. Read the output, not the exit code.
- Works unchanged as the discovery script of a configuration item with
data type String: compliant when the value begins with "AI tools: none".
Runs on Windows PowerShell 5.1 (3.0 or later) as the computer account,
which can read every profile under C:\Users.
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 # Run Scripts truncates output at 4 KB; stay well under it.
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) + '...' }
Write-Output $line
exit 0
It always exits 0. Run Scripts treats exit code 0 as a successful run, and a configuration item treats a non-zero exit as a script error rather than a result, so the finding is in the output line, not the exit code. A clean device prints AI tools: none found in N profiles.
Option 1: Run Scripts
Use this for a one-time audit or to check a collection right now.
- In the Configuration Manager console, go to Software Library › Scripts and select Create Script.
- Name it something like Kuntur AI inventory, set the language to PowerShell and import
kuntur-ai-inventory-sccm.ps1. It takes no parameters. Finish the wizard. - Have a second admin select the script and choose Approve/Deny, then approve it. An approver comment with your change ticket is good practice.
- Go to Assets and Compliance › Device Collections, select the collection and choose Run Script. Pick the approved script and finish the wizard.
Run Scripts uses a fast notification channel and the run times out after one hour. Devices that are off during that hour do not run it later; run the script again for them.
Option 2: a configuration item
Use this when you want the check to repeat on a schedule and show up in compliance reports. The same script works as a discovery script without changes.
- Under Assets and Compliance › Compliance Settings › Configuration Items, create a Windows configuration item.
- Add a setting of type Script with data type String, and paste the script as the discovery script (Windows PowerShell). Leave the remediation script empty, and do not run it with the logged-on user's credentials, so it runs as Local System.
- Add a compliance rule on the value returned by the script: compliant when it begins with
AI tools: none. If your console offers different string operators, a rule that the value containsnone foundworks the same way. - Add the item to a configuration baseline and deploy the baseline to a device collection with a daily schedule.
Devices that report non-compliant have at least one AI tool. The exact labels in the configuration item wizard vary a little between console versions; the setting type, data type and rule are what matter.
Read the results
For Run Scripts, open Monitoring › Script Status and open the run. The run's details show the exit code (0) and the output line for each device that ran it, so you can see at a glance which devices print something other than AI tools: none found.
For the configuration item, use the baseline's deployment status under Monitoring › Deployments, or the compliance reports, to list non-compliant devices. Then run the script on those devices through Run Scripts to read the one-line detail for each.
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. Run Scripts shows what existed when it ran; the configuration item shows what existed at its last evaluation. A tool installed and removed in between 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 Configuration Manager script gives you a snapshot as one line per device. The Kuntur agent is an MSI that installs silently with msiexec /qn, so you can deploy it as a regular Configuration Manager application 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)
- Workspace ONE UEM (sensor)
- NinjaOne
- Datto RMM
- ConnectWise Automate
- PDQ Inventory and PDQ Deploy
- 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
- Why does the script always exit with 0?
- Run Scripts reads exit code 0 as a successful run, and a configuration item treats a non-zero exit code as a script failure, not as a finding. The result is in the output line instead: it starts with
AI tools: none foundon a clean device. - Can I approve my own script in Run Scripts?
- Not by default. The hierarchy setting Script authors require additional script approver blocks it. Microsoft recommends allowing self-approval only in a lab.
- 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.