简体   繁体   English

如何使用WMI列出设备类型?

[英]How do I list device types using WMI?

I'm using WMI Code Creator to generate code to help list the types of devices shown in Device Manager. 我正在使用WMI Code Creator生成代码,以帮助列出设备管理器中显示的设备类型。 I'm trying to detect the presence of a debugger that shows up in Device manager as its own type (eg Listed under my computer, the categories are Computer, Disk drives, Display adapters, Jungo..... Jungo is the one I want) 我正在尝试检测调试器的存在,该调试器显示在设备管理器中作为其自己的类型(例如,在我的计算机下列出,类别是计算机,磁盘驱动器,显示适配器,Jungo ..... Jungo是我的一个想)

Under Jungo, PEMicro USB Multilink (i0) and PEMicro USB Serial Port (i1) show up. 在Jungo下,PEMicro USB Multilink(i0)和PEMicro USB串行端口(i1)出现。 I'm simply trying to verify that the device is present and detected by windows prior to continuing. 我只是想在继续之前验证设备是否存在并由Windows检测到。

What is the proper namespace? 什么是正确的命名空间? Is it root\\CIMV2? 它是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. 我之前没有WMI经验,所以请告诉我哪些其他信息会有所帮助。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM