开发者

WMI query to Win32_Directory not returning all results

开发者 https://www.devze.com 2023-04-11 01:22 出处:网络
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.

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 pret开发者_如何学Cty 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!!

0

精彩评论

暂无评论...
验证码 换一张
取 消