How do I list device types using WMI?

≡放荡痞女 提交于 2019-12-01 23:10:41

问题


I'm using WMI Code Creator to generate code to help list the types of devices shown in Device Manager. I'm trying to detect the presence of a debugger that shows up in Device manager as its own type (e.g. Listed under my computer, the categories are Computer, Disk drives, Display adapters, Jungo..... Jungo is the one I want)

Under Jungo, PEMicro USB Multilink (i0) and PEMicro USB Serial Port (i1) show up. I'm simply trying to verify that the device is present and detected by windows prior to continuing.

What is the proper namespace? Is it root\CIMV2? If so, what Class, and what properties would this be?

I have no prior WMI experience, so let me know what additional information would be helpful.


回答1:


Checkout the sample snippet which displays all the installed devices on your computer.

strComputer = "." 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") 
Set colItems = objWMIService.ExecQuery( _
    "SELECT * FROM Win32_PnPSignedDriver",,48) 
For Each objItem in colItems 
    Wscript.Echo "-----------------------------------"
    Wscript.Echo "Win32_PnPSignedDriver instance"
    Wscript.Echo "-----------------------------------"
    Wscript.Echo "DeviceName: " & objItem.DeviceName
Next


来源:https://stackoverflow.com/questions/1596950/how-do-i-list-device-types-using-wmi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!