Device ID disappear in WQL query after device uninstall

G

Guest

Hello all,

I'm trying to use WQL query to get Device ID's of existent (not obligatory
installed) devices.
Thus I used next VBscript:

On Error Resume Next
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
arrComputers = Array("localhost")

For Each strComputer In arrComputers
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM
Win32_SystemDevices", "WQL", wbemFlagReturnImmediately +
wbemFlagForwardOnly)
For Each objItem In colItems
WScript.Echo objItem.PartComponent
Next
Next

And it works fine until you not try to install and then uninstall some PCI
device. After uninstall this device (NIC in my case) disappear from the
generated list and reappeares in it only after reboot or reinstall.
The device is still be visible via external PCI space readers, but is not
visible via WMI. Looks like WMI device list is not updated in some cases.
May be somebody knows (I'm a newbie in WMI) if this is a bug or supposed
behaviour and how can it be overcomed (via WMI or any other Windows API).

My target is to be able to scan PCI space from Windows and to get list of
all attached phisically devices (mainly to see their Device ID's)
nevertheless they were installed/uninstalled or the both arbitrary number of
times.

Thanks in advance,
Vladislav Mintz.
Intel Israel, SSG SV.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top