How to Inventory AI Tools on Windows Endpoints with NinjaOne
If you already manage Windows laptops with NinjaOne, you can get a first AI inventory today without new software. This guide gives you a read-only PowerShell script, shows where to add it in NinjaOne, and explains how to review the results across devices.
Why your software inventory misses these tools
Most AI coding tools install per user, without admin rights. Claude Code's native installer puts a single binary in the user's home folder. Codex CLI and Gemini CLI usually arrive through npm into %APPDATA%\npm. Cursor, Windsurf and Ollama install under %LOCALAPPDATA%\Programs. None of that has to appear in the installed-programs list that software inventories read, so a device can look clean while several AI agents run on it.
The fix is to look where these tools actually live, in every user profile, and store what you find where you can search it. NinjaOne already has both pieces: scripts that run as System on a schedule, and custom fields that keep the output on each device.
What the script checks
For every folder under C:\Users (skipping Public and Default), it looks for:
| Category | Tools | Where it looks |
|---|---|---|
| AI coding CLIs | Claude Code, Codex CLI, Gemini CLI | .local\bin\claude.exe, %APPDATA%\npm\node_modules, the .claude and .codex data folders |
| AI IDEs and desktop apps | Cursor, Windsurf, Claude desktop, ChatGPT desktop | %LOCALAPPDATA%\Programs and Microsoft Store package folders |
| Local models | Ollama (with model names), LM Studio | .ollama\models\manifests and program folders |
| Editor extensions | GitHub Copilot, Claude Code, Cline, Roo Code, Continue, Codeium, Tabnine, Amazon Q, Gemini Code Assist, Cody | .vscode\extensions and the matching folders for Cursor and Windsurf |
| MCP servers | Configured servers per client (count only) | Config files for Claude desktop, Claude Code, Cursor, VS Code and Windsurf |
It is read-only. It tests whether files and folders exist, and for MCP configs it parses the JSON only to count servers. It never prints file contents, so API keys stored in those configs stay out of the output. It makes no network calls.
The output is one line per user with findings, under a header with the date. For example:
Kuntur AI inventory 2026-11-02 09:14 | profiles: 3 | findings: 7
alice: Claude Code (native); Cursor; Ollama (models: llama3:8b, qwen2.5-coder:7b); AI extensions: github.copilot; MCP servers: Claude desktop 1, Cursor 2
bob: Codex CLI (npm); ChatGPT desktop
Create the custom field
The script writes its summary to a device custom field, so the result stays on the device record.
- Go to Administration → Devices → Device Custom Fields and add a field.
- Choose the Multi-line type. Multi-line fields hold up to 10,000 characters; the script trims its output to fit.
- Give it a label such as AI tools inventory. NinjaOne fills in the internal name. The script writes to
aiToolsInventoryby default, so use that name or pass a different one with-CustomField. - Under Permissions, give Automations read/write access so scripts can update the field, and set technicians to Read Only.
- Click Submit. The value appears on each device dashboard under the Custom tab.
Add the script to the Automation Library
- Go to Administration → Library → Automation, click Add automation and choose New Script.
- Name it, for example AI tools inventory (read-only). Set Language to PowerShell, Operating system to Windows and Architecture to All.
- Set Run as to System. Running as the current user only sees that user's profile.
- Paste the script from below, or from the plain-text file, and click Save.
- Run it once on a test device. Check the activity output and the device's Custom tab.
Run it on a schedule with a policy
- Go to Administration → Policies and open the Windows agent policy for the devices you want to cover.
- Open Scheduled Automations, click Add automation, pick the script from the Automation Library and choose System to run it.
- In Settings, give it a name and a schedule. Daily is enough for an inventory. On User Login also works if laptops are often off overnight.
- Click Add and save the policy.
Review the results across devices
Each device keeps its latest summary in the custom field; every run overwrites the previous value. To review the whole fleet, export from the device search with Export with custom fields and filter the AI tools inventory column in a spreadsheet. Rows other than "No AI tools found" are your starting list. Look at MCP servers and AI coding CLIs first: they read code and run commands with the user's permissions.
The script
Download kuntur-ai-inventory-ninjaone.ps1. Requires Windows PowerShell 5.1 or later.
SHA-256: 3bc43ff6c8b2b32a1423d00fb3960f09adf73317ce451e92ffc4a315b6c0da96
<#
.SYNOPSIS
Read-only inventory of AI tools on a Windows endpoint, for NinjaOne.
.DESCRIPTION
Checks every user profile for AI coding CLIs, AI desktop apps and IDEs,
local model runners, AI editor extensions and MCP configuration files.
It only tests whether files and folders exist and counts MCP servers.
It never prints file contents, prompts, tokens or keys, and makes no
network calls.
Run it as System so it can see every profile. The summary is printed to
the activity output and, when the NinjaOne agent module is present,
written to a device custom field (Multi-line, Automations: Read/Write).
Source: https://kuntur.io/guides/ninjaone-detect-ai-tools
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' }),
# Internal name of the NinjaOne custom field. Leave empty to only print.
[string]$CustomField = 'aiToolsInventory'
)
$ErrorActionPreference = 'SilentlyContinue'
$skip = @('Public', 'Default', 'Default User', 'All Users', 'defaultuser0', 'WDAGUtilityAccount')
function J { param([Parameter(ValueFromRemainingArguments = $true)][string[]]$Parts) [IO.Path]::Combine([string[]]$Parts) }
function Has { param([string]$Path) return (Test-Path -LiteralPath $Path) }
function HasLike {
param([string]$Parent, [string]$Filter)
if (-not (Has $Parent)) { return $false }
return [bool](Get-ChildItem -LiteralPath $Parent -Filter $Filter -Directory -Force -ErrorAction SilentlyContinue | Select-Object -First 1)
}
function McpCount {
# Counts servers in an MCP config without printing any of its values.
param([string]$Path)
if (-not (Has $Path)) { return -1 }
try {
$j = Get-Content -LiteralPath $Path -Raw -ErrorAction Stop | ConvertFrom-Json -ErrorAction Stop
$n = 0
foreach ($key in @('mcpServers', 'servers')) {
$node = $j.$key
if ($node) { $n += @($node.PSObject.Properties).Count }
}
return $n
} catch { return 0 }
}
$aiExtensions = @(
'github.copilot', 'github.copilot-chat', 'anthropic.claude-code', 'openai.chatgpt',
'continue.continue', 'saoudrizwan.claude-dev', 'rooveterinaryinc.roo-cline',
'codeium.codeium', 'tabnine.tabnine-vscode', 'amazonwebservices.amazon-q-vscode',
'google.geminicodeassist', 'sourcegraph.cody-ai'
)
$lines = New-Object System.Collections.Generic.List[string]
$profilesSeen = 0
$toolCount = 0
$profiles = Get-ChildItem -LiteralPath $ProfileRoot -Directory -Force -ErrorAction SilentlyContinue |
Where-Object { $skip -notcontains $_.Name -and -not $_.Name.StartsWith('.') }
foreach ($p in $profiles) {
$profilesSeen++
$u = $p.FullName
$roam = J $u 'AppData' 'Roaming'
$local = J $u 'AppData' 'Local'
$progs = J $local 'Programs'
$pkgs = J $local 'Packages'
$npm = J $roam 'npm' 'node_modules'
$found = New-Object System.Collections.Generic.List[string]
# AI coding CLIs
$how = @()
if (Has (J $u '.local' 'bin' 'claude.exe')) { $how += 'native' }
if (Has (J $npm '@anthropic-ai' 'claude-code')) { $how += 'npm' }
if ($how.Count -gt 0) { $found.Add("Claude Code ($($how -join '+'))") }
elseif (Has (J $u '.claude')) { $found.Add('Claude Code (data folder only)') }
if (Has (J $npm '@openai' 'codex')) { $found.Add('Codex CLI (npm)') }
elseif (Has (J $u '.codex')) { $found.Add('Codex CLI (data folder only)') }
if ((Has (J $npm '@google' 'gemini-cli')) -or (Has (J $roam 'npm' 'gemini.cmd'))) { $found.Add('Gemini CLI (npm)') }
# AI IDEs and desktop apps
if (Has (J $progs 'cursor')) { $found.Add('Cursor') }
if (Has (J $progs 'Windsurf')) { $found.Add('Windsurf') }
if ((Has (J $local 'AnthropicClaude')) -or (Has (J $progs 'Claude')) -or (HasLike $pkgs 'Claude_*') -or (HasLike $pkgs 'AnthropicPBC.Claude*')) { $found.Add('Claude desktop') }
if ((Has (J $progs 'ChatGPT')) -or (HasLike $pkgs 'OpenAI.ChatGPT-Desktop_*')) { $found.Add('ChatGPT desktop') }
# Local model runners
$models = @()
$manifests = J $u '.ollama' 'models' 'manifests' 'registry.ollama.ai' 'library'
if (Has $manifests) {
foreach ($m in Get-ChildItem -LiteralPath $manifests -Directory -Force) {
foreach ($t in Get-ChildItem -LiteralPath $m.FullName -File -Force) { $models += "$($m.Name):$($t.Name)" }
}
}
if ((Has (J $progs 'Ollama')) -or $models.Count -gt 0) {
if ($models.Count -gt 0) { $found.Add("Ollama (models: $(($models | Select-Object -First 8) -join ', '))") }
else { $found.Add('Ollama') }
}
if ((Has (J $progs 'LM Studio')) -or (Has (J $progs 'lm-studio')) -or (Has (J $u '.lmstudio'))) { $found.Add('LM Studio') }
# AI extensions in VS Code (and VS Code-based editors that share the layout)
$ext = @()
foreach ($dir in @((J $u '.vscode' 'extensions'), (J $u '.cursor' 'extensions'), (J $u '.windsurf' 'extensions'))) {
if (-not (Has $dir)) { continue }
foreach ($e in Get-ChildItem -LiteralPath $dir -Directory -Force) {
foreach ($id in $aiExtensions) {
if ($e.Name.ToLower().StartsWith("$id-")) { $ext += $id }
}
}
}
$ext = $ext | Sort-Object -Unique
if ($ext.Count -gt 0) { $found.Add("AI extensions: $($ext -join ', ')") }
# MCP configuration files (server count only)
$mcp = @()
$configs = [ordered]@{
'Claude desktop' = (J $roam 'Claude' 'claude_desktop_config.json')
'Claude Code' = (J $u '.claude.json')
'Cursor' = (J $u '.cursor' 'mcp.json')
'VS Code' = (J $roam 'Code' 'User' 'mcp.json')
'Windsurf' = (J $u '.codeium' 'windsurf' 'mcp_config.json')
}
foreach ($k in $configs.Keys) {
$n = McpCount $configs[$k]
if ($n -gt 0) { $mcp += "$k $n" }
}
if ($mcp.Count -gt 0) { $found.Add("MCP servers: $($mcp -join ', ')") }
if ($found.Count -gt 0) {
$toolCount += $found.Count
$lines.Add("$($p.Name): $($found -join '; ')")
}
}
$header = "Kuntur AI inventory $(Get-Date -Format 'yyyy-MM-dd HH:mm') | profiles: $profilesSeen | findings: $toolCount"
if ($lines.Count -eq 0) { $lines.Add('No AI tools found in user profiles.') }
$summary = (@($header) + $lines) -join "`n"
if ($summary.Length -gt 9500) { $summary = $summary.Substring(0, 9500) + "`n(truncated)" }
Write-Output $summary
if ($CustomField) {
try {
if (Get-Command Set-NinjaProperty -ErrorAction SilentlyContinue) {
Set-NinjaProperty -Name $CustomField -Value $summary
} elseif (Get-Command Ninja-Property-Set -ErrorAction SilentlyContinue) {
Ninja-Property-Set $CustomField $summary
} else {
Write-Output "(NinjaOne module not found: custom field '$CustomField' not updated)"
}
} catch {
Write-Output "(Could not write custom field '$CustomField': $($_.Exception.Message))"
}
}
exit 0
What it does not cover
- WSL, Docker and virtual machines. Tools inside a WSL distro or a container live in their own file systems. See How to find Claude Code and Codex CLI running in WSL and AI in Docker containers.
- Browser-only AI. ChatGPT or Claude used in a browser tab leaves no install to find.
- New tools. The script checks a fixed list. Anything released after you copied it, or installed in an unusual folder, is invisible to it.
- Point in time. It shows what was there at the last run, not what ran in between.
- Install versus use. A folder can be left over from an old install. Check modification times before acting on a single finding.
Keep the inventory current
The script is a good first pass. If you want the inventory to stay current without maintaining a list yourself, the Kuntur agent reports the same categories from Windows, macOS and Linux, including WSL distros and containers, with the environment each tool ran in. You mark each tool approved or unauthorized and keep a record of every decision. The agent ships as an MSI you can deploy from NinjaOne.
To try it on one machine first, the free scanner writes the same kind of report locally and uploads nothing:
- 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
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.
FAQ
- Should the script run as System or as the logged-on user?
- Run it as System. A System run can read every profile under
C:\Users, which is where these tools install. A run as the current user only sees that user's own profile. - Does the script send anything outside NinjaOne?
- No. It makes no network calls. It checks whether known files and folders exist, counts MCP servers, prints a summary and, if the NinjaOne module is present, writes that summary to the custom field you name.
- Does it read prompts, code or API keys?
- No. It never prints file contents. For MCP configuration files it only parses the JSON to count server entries, so tokens stored in those files are not output.
- What does it miss?
- Tools inside WSL distributions, Docker containers and virtual machines, AI used only in the browser, copies in unusual folders, and anything new that is not on the script's list. It also only shows what was there when it last ran.
Sources
- NinjaOne docs: Getting started with automation scripting
- NinjaOne docs: Scheduled automations under policy
- NinjaOne docs: Creating custom fields
- NinjaOne docs: Custom fields, scripting reads and writes
- NinjaOne docs: CLI, custom fields and documentation scripting
- NinjaOne docs: Custom fields FAQ
- NinjaOne docs: Advanced custom fields
More guides and tools:
- How to detect Claude Code on company laptops
- How to detect MCP servers
- How to detect Ollama and local LLMs
- Free tool: MCP config auditor
- Detect AI Tools on Windows with Configuration Manager (SCCM)
- Detect AI Tools on Windows with a Workspace ONE UEM Sensor
- Detect AI Tools on Windows with a Datto RMM Component
- Detect AI Tools on Windows with a ConnectWise Automate Script
- Detect AI Tools on Windows with CrowdStrike Real Time Response
- Detect AI Tools on Windows with PDQ Inventory and PDQ Deploy
- All guides