How to Detect AI Tools with ManageEngine Endpoint Central
ManageEngine Endpoint Central can run a script on every Windows PC and Mac and show the result per computer. This guide gives you two read-only scripts, PowerShell for Windows and bash for macOS, that list the AI apps, coding agents, local models, IDE extensions and MCP configs on each machine, for every user.
How Endpoint Central custom scripts report results
Both scripts are deployed as a Custom Script computer configuration. According to ManageEngine's documentation:
- Scripts come from the Script Repository. Add the file there first, then pick it with the Repository option. Windows accepts
.ps1among other types; Mac accepts.sh. - Exit code 0 is success. Any other code not listed in the Exit codes field marks the run as Failed and triggers retries if you enabled them.
- Output goes to Remarks. With Enable logging for troubleshooting and Frequency Once, the script output is shown in the Remarks of the configuration's Execution Status.
- Windows scripts can run as the System user. Then
%USERPROFILE%points at the System profile, so the script walks every folder underC:\Usersitself.
What the scripts look for
The checks come from Kuntur's public detection catalog: install folders, binaries, global npm packages and data folders that exist only when a tool is installed or has been used. They cover AI desktop apps (Claude, ChatGPT, Codex, Gemini, Cursor, Windsurf, Ollama, LM Studio), coding agents (Claude Code, Codex CLI, Gemini CLI), local models, AI extensions in VS Code, Cursor and Windsurf, and MCP configuration files. MCP files are only counted, never opened: they often hold API tokens in plain text, and an inventory has no business copying them into MDM logs. To review one, paste it into the free MCP config auditor, which runs in your browser.
Windows: the PowerShell script
Read-only, no network, prints one line such as AI tools: Claude Code(2), Cursor(1), MCP configs(1; 3 servers) | users: ana,bob. It always exits 0, so read the Remarks, not the status.
Download it as kuntur-ai-inventory-manageengine.ps1. SHA-256 of the published file, before you edit it:
8d8422c8cfbc352a698d27e6a7c4abfae80838879e83d76f3f34e96b4b1f75a5
<#
Kuntur AI inventory - ManageEngine Endpoint Central custom script (Windows)
https://kuntur.io/guides/manageengine-endpoint-central-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, SCCM and NinjaOne scripts.
Output and exit code (Endpoint Central)
- Prints ONE line of text. With "Enable logging for troubleshooting" and
Frequency "Once", Endpoint Central shows it in the Remarks column of
the configuration's Execution Status.
- Always exits 0, so the configuration shows Succeeded and is never
retried. Read the output, not the status.
Deploy it as a Computer Configuration that runs as the System user, which
can read every profile under C:\Users (%USERPROFILE% would point at the
System profile). Runs on Windows PowerShell 5.1 (3.0 or later).
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 # keep the Remarks line short
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
macOS: the bash script
Read-only, no network, prints one line per tool with the user and path. Edit the ALLOW line with the tools you have approved, using the names exactly as printed and separated by |. It exits 1 when it finds a tool that is not on the allowlist, so those Macs show as Failed in Execution Status: that is a finding, not an error, so leave retries off.
Download it as kuntur-ai-inventory-manageengine-mac.sh. SHA-256 of the published file, before you edit it:
267b1f59e6100c9a27abc634019ca7f204617ab13de720858ce9176ed3e839fa
#!/bin/bash
# Kuntur AI inventory: ManageEngine Endpoint Central custom script (macOS).
# https://kuntur.io/guides/manageengine-endpoint-central-detect-ai-tools
#
# Read-only. Makes no network calls, changes nothing and never prints the
# contents of any file. It only checks whether known paths exist.
# It walks every real user under /Users, whichever account runs it.
#
# Exit 0 = Succeeded: no AI tools found, or only tools on the allowlist.
# Exit 1 = Failed in Endpoint Central: at least one AI tool not on the allowlist.
# Leave retries off for this configuration: a Failed run is a finding, not an error.
#
# Allowlist: tool names exactly as printed below, separated by "|".
# Example: ALLOW="GitHub Copilot|Claude Desktop"
ALLOW="${ALLOW-}"
# Only change these to test the script on a fake directory tree.
USERS_ROOT="${USERS_ROOT:-/Users}"
APPS_DIR="${APPS_DIR:-/Applications}"
BIN_DIRS="${BIN_DIRS:-/usr/local/bin /opt/homebrew/bin}"
NPM_DIRS="${NPM_DIRS:-/usr/local/lib/node_modules /opt/homebrew/lib/node_modules}"
HT="~" # shown instead of the full home path
FOUND=0
REVIEW=0
SEEN="
"
is_allowed() {
local name="$1" item
local IFS='|'
for item in $ALLOW; do
[ "$item" = "$name" ] && return 0
done
return 1
}
# report SCOPE KIND NAME WHERE
report() {
local scope="$1" kind="$2" name="$3" where="$4" status key
key="$scope|$name"
case "$SEEN" in
*"
$key
"*) return 0 ;;
esac
SEEN="$SEEN$key
"
FOUND=$((FOUND + 1))
if is_allowed "$name"; then
status="approved"
else
status="review"
REVIEW=$((REVIEW + 1))
fi
printf '[%s] %s: %s - %s (%s)\n' "$scope" "$kind" "$name" "$where" "$status"
}
# First existing match of a glob pattern, or nothing.
first_match() {
local p
for p in "$@"; do
[ -e "$p" ] && { printf '%s' "$p"; return 0; }
done
return 1
}
check_app() { # SCOPE DIR APPNAME DISPLAYNAME
[ -d "$2/$3.app" ] && report "$1" "AI app" "$4" "$2/$3.app"
}
check_apps() { # SCOPE DIR
check_app "$1" "$2" "Claude" "Claude Desktop"
check_app "$1" "$2" "ChatGPT" "ChatGPT Desktop"
check_app "$1" "$2" "ChatGPT Atlas" "ChatGPT Atlas"
check_app "$1" "$2" "Codex" "Codex Desktop"
check_app "$1" "$2" "Gemini" "Gemini Desktop"
check_app "$1" "$2" "Cursor" "Cursor"
check_app "$1" "$2" "Windsurf" "Windsurf"
check_app "$1" "$2" "Ollama" "Ollama"
check_app "$1" "$2" "LM Studio" "LM Studio"
}
check_npm() { # SCOPE NODE_MODULES_DIR SHOWN_PREFIX
[ -d "$2/@anthropic-ai/claude-code" ] && report "$1" "CLI agent" "Claude Code" "$3/@anthropic-ai/claude-code (npm)"
[ -d "$2/@openai/codex" ] && report "$1" "CLI agent" "Codex CLI" "$3/@openai/codex (npm)"
[ -d "$2/@google/gemini-cli" ] && report "$1" "CLI agent" "Gemini CLI" "$3/@google/gemini-cli (npm)"
return 0
}
check_ext() { # SCOPE EXT_DIR SHOWN_DIR ID DISPLAYNAME
local hit
hit=$(first_match "$2/$4"-[0-9]*) && report "$1" "IDE extension" "$5" "$3/${hit##*/}"
return 0
}
check_extensions() { # SCOPE EXT_DIR SHOWN_DIR
[ -d "$2" ] || return 0
check_ext "$1" "$2" "$3" "github.copilot" "GitHub Copilot"
check_ext "$1" "$2" "$3" "github.copilot-chat" "GitHub Copilot Chat"
check_ext "$1" "$2" "$3" "anthropic.claude-code" "Claude Code for VS Code"
check_ext "$1" "$2" "$3" "openai.chatgpt" "Codex for VS Code"
check_ext "$1" "$2" "$3" "saoudrizwan.claude-dev" "Cline"
check_ext "$1" "$2" "$3" "rooveterinaryinc.roo-cline" "Roo Code"
check_ext "$1" "$2" "$3" "kilocode.kilo-code" "Kilo Code"
check_ext "$1" "$2" "$3" "continue.continue" "Continue"
check_ext "$1" "$2" "$3" "codeium.codeium" "Windsurf Plugin (Codeium)"
check_ext "$1" "$2" "$3" "google.geminicodeassist" "Gemini Code Assist"
check_ext "$1" "$2" "$3" "amazonwebservices.amazon-q-vscode" "Amazon Q"
check_ext "$1" "$2" "$3" "tabnine.tabnine-vscode" "Tabnine"
}
check_mcp() { # SCOPE HOME FILE_RELATIVE_TO_HOME LABEL
[ -f "$2/$3" ] && report "$1" "MCP config" "$4" "$HT/$3"
return 0
}
check_user() { # USERNAME HOME
local u="$1" h="$2" hit
if hit=$(first_match "$h/.local/bin/claude" "$h/.claude/local/claude" "$h/.local/share/claude/versions"); then
report "$u" "CLI agent" "Claude Code" "$HT${hit#"$h"}"
elif [ -d "$h/.claude" ]; then
report "$u" "CLI agent" "Claude Code" "$HT/.claude (data folder)"
fi
[ -d "$h/.codex" ] && report "$u" "CLI agent" "Codex CLI" "$HT/.codex"
[ -d "$h/.gemini" ] && report "$u" "CLI agent" "Gemini CLI" "$HT/.gemini"
check_npm "$u" "$h/.npm-global/lib/node_modules" "$HT/.npm-global/lib/node_modules"
local nvm
for nvm in "$h"/.nvm/versions/node/*/lib/node_modules; do
[ -d "$nvm" ] && check_npm "$u" "$nvm" "$HT${nvm#"$h"}"
done
check_apps "$u" "$h/Applications"
if [ -d "$h/.ollama/models" ]; then
report "$u" "Local model" "Ollama models" "$HT/.ollama/models"
elif [ -d "$h/.ollama" ]; then
report "$u" "Local model" "Ollama" "$HT/.ollama"
fi
if hit=$(first_match "$h/.lmstudio" "$h/.cache/lm-studio"); then
report "$u" "Local model" "LM Studio" "$HT${hit#"$h"}"
fi
check_extensions "$u" "$h/.vscode/extensions" "$HT/.vscode/extensions"
check_extensions "$u" "$h/.cursor/extensions" "$HT/.cursor/extensions"
check_extensions "$u" "$h/.windsurf/extensions" "$HT/.windsurf/extensions"
check_mcp "$u" "$h" "Library/Application Support/Claude/claude_desktop_config.json" "Claude Desktop MCP servers"
check_mcp "$u" "$h" ".claude.json" "Claude Code MCP servers"
check_mcp "$u" "$h" ".cursor/mcp.json" "Cursor MCP servers"
check_mcp "$u" "$h" "Library/Application Support/Code/User/mcp.json" "VS Code MCP servers"
check_mcp "$u" "$h" ".codeium/windsurf/mcp_config.json" "Windsurf MCP servers"
return 0
}
printf 'Kuntur AI inventory (read-only) on %s, %s\n' "$(hostname 2>/dev/null)" "$(date -u '+%Y-%m-%d %H:%M UTC')"
# Machine-wide installs.
check_apps "machine" "$APPS_DIR"
for d in $BIN_DIRS; do
[ -e "$d/claude" ] && report "machine" "CLI agent" "Claude Code" "$d/claude"
[ -e "$d/codex" ] && report "machine" "CLI agent" "Codex CLI" "$d/codex"
[ -e "$d/gemini" ] && report "machine" "CLI agent" "Gemini CLI" "$d/gemini"
[ -e "$d/ollama" ] && report "machine" "Local model" "Ollama" "$d/ollama"
done
for d in $NPM_DIRS; do
check_npm "machine" "$d" "$d"
done
# Every real user home (skips Shared, Guest and hidden folders).
for home in "$USERS_ROOT"/*/; do
home="${home%/}"
user="${home##*/}"
case "$user" in
Shared|Guest|.*) continue ;;
esac
[ -d "$home" ] || continue
check_user "$user" "$home"
done
if [ "$FOUND" -eq 0 ]; then
echo "Summary: no AI tools found."
exit 0
fi
printf 'Summary: %d AI tool(s) found, %d not on the allowlist.\n' "$FOUND" "$REVIEW"
[ "$REVIEW" -gt 0 ] && exit 1
exit 0
Add them in Endpoint Central
- Add
kuntur-ai-inventory-manageengine.ps1andkuntur-ai-inventory-manageengine-mac.shto the Script Repository. - Windows: go to Configurations > Add Configurations > Windows Configuration > Custom Script > Computer Configuration. Choose Repository, select the PowerShell script, run it as the System user, set Frequency to Once and turn on Enable logging for troubleshooting.
- Mac: go to Configurations > Add Configurations > Mac Configuration > Custom Script > Computer Configuration, choose Repository, select the bash script, Frequency Once, logging on.
- Target a pilot group first (for example the IT team), leave retries off, and deploy.
- Open All configurations, select the configuration and read Execution Status: the Remarks column holds each computer's result.
Logging is only available with Frequency Once, so for a periodic inventory redeploy the configuration on a schedule that suits you (monthly is plenty), or move to an agent that reports continuously.
What the scripts do not see
- Browser-only use. ChatGPT, Claude or Gemini in a browser tab leave nothing in these paths.
- Unusual install locations. A renamed binary, a CLI unpacked into a project folder or a custom npm prefix is missed.
- WSL, containers and VMs. They have their own file systems; see Claude Code and Codex in WSL and AI in Docker containers and VMs.
- New tools. The list is fixed when you paste it; a tool released next month stays invisible until you add a check.
Keep the inventory current
To check one machine without the MDM, run the free Kuntur scanner. It lists the same categories and more, and writes an HTML report on the machine.
- 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 | iexIt needs no account and no admin rights, writes an HTML report to the Desktop and uploads nothing.
The script above is a fixed list you maintain by hand. Across a fleet, the Kuntur agent reports AI tools on Windows, macOS and Linux from a catalog that is updated centrally, and keeps each approve-or-not decision with its history. It detects and reports; it does not block or uninstall anything. The deployment page covers installing the agent with an MDM.
Kuntur detects and reports; it does not block, restrict or uninstall anything. Free for up to 5 endpoints; Pro is US$3 per endpoint per month.
FAQ
- Can Endpoint Central show the script output?
- Yes. With Enable logging for troubleshooting and Frequency Once, the output appears in the Remarks of the configuration's Execution Status, per computer.
- Why run the Windows script as the System user?
- The System account can read every profile under
C:\Users. The script walks those folders itself, so it does not depend on%USERPROFILE%, which points at the System profile in that context. - Does the script uninstall or block anything?
- No. Both scripts only check whether known paths exist and print what they find. Kuntur does not block or uninstall tools either; enforcement stays with your MDM or app control.
- Does it read API keys or MCP tokens?
- No. MCP configuration files are counted, never opened, and no file contents are printed.
Sources
- ManageEngine Endpoint Central help: Executing custom scripts (Windows computer configuration)
- ManageEngine Endpoint Central help: Executing custom scripts for Mac computers
- Kuntur detection catalog
More guides and tools: