对 Win32_Directory 的 WMI 查询未返回所有结果

发布于 2024-12-08 02:14:32 字数 1124 浏览 1 评论 0原文

我正在对远程计算机运行一些 WMI 查询(来自 JavaScript/JScript、WMIC、下载的 WMI 查询工具 - 这没有区别),我对此具有管理员权限。

该查询针对 Win32_Directory 类,它尝试查找目标服务器上名为“db”、“hooks”、“conf”或“locks”的所有文件夹,但它不会返回所有文件夹;它只得到大约 150 个。

我尝试过的查询是:

SELECT drive, path, filename 
FROM Win32_Directory 
WHERE filename = 'db' 
   OR filename = 'conf' 
   OR filename = 'hooks' 
   OR filename = 'locks'

和:

SELECT drive, path, filename 
FROM Win32_Directory 
WHERE name LIKE '%\\db' 
   OR name LIKE '%\\conf' 
   OR name LIKE '%\\locks' 
   OR name LIKE '%\\hooks'

或者,在 WMIC 中(来自本地计算机):

wmic fsdir where (name like '%\\db' or name like '%\\conf' or name like '%\\hooks' or name like '%\\locks') get drive,path,name

我很确定我已经使用 \'\\ 适用于 JScript,我使用对 var wmiResults = wmi.ExecQuery(wql, 'WQL', 32); 的基本调用来获取结果集。

在本地计算机上运行的等效批处理命令会返回更多结果:

for /r %A in (db,conf,hooks,locks) do @if exist "%~A" echo %~A

就像正在进行某种缓存或分页,或者索引需要重建,但我不知道从哪里开始告诉它刷新其缓存或检索所有结果。

帮助!!

I'm running some WMI queries against a remote computer (from JavaScript/JScript, WMIC, a downloaded WMI query tool -- it makes no difference), to which I have adminstrator privileges.

The query is against the Win32_Directory class and it attempts to find all folders on the target server, called 'db', 'hooks', 'conf' or 'locks', but it is not returning all folders; it only gets about 150 of them.

The queries I have tried are:

SELECT drive, path, filename 
FROM Win32_Directory 
WHERE filename = 'db' 
   OR filename = 'conf' 
   OR filename = 'hooks' 
   OR filename = 'locks'

and:

SELECT drive, path, filename 
FROM Win32_Directory 
WHERE name LIKE '%\\db' 
   OR name LIKE '%\\conf' 
   OR name LIKE '%\\locks' 
   OR name LIKE '%\\hooks'

or, in WMIC (from the local machine):

wmic fsdir where (name like '%\\db' or name like '%\\conf' or name like '%\\hooks' or name like '%\\locks') get drive,path,name

I'm pretty sure I've got my escaping sorted using \' and \\ where appropriate for JScript, and I'm using a basic call to var wmiResults = wmi.ExecQuery(wql, 'WQL', 32); to get the results set.

The equivalent batch command, run on the local machine returns far more results:

for /r %A in (db,conf,hooks,locks) do @if exist "%~A" echo %~A

It's like there's some sort of caching or paging going on, or an index needs rebuilding, but I don't know where to start to tell it to refresh its cache or retrieve all results.

Help!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文