如何通过WMI将所有智能卡读卡器安装到系统上? [英] How do I get all the smart card readers on my system via WMI?

查看:200
本文介绍了如何通过WMI将所有智能卡读卡器安装到系统上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用WMI获取系统上所有PCSC智能卡读卡器的DeviceID和服务.它们都通过USB连接,因此我在WMI注册表中查询所有Win32_PnPEntity.但是我不知道如何确定哪些设备是读卡器".这是我已经拥有的:

I want to get the DeviceID and Service of all PCSC smart card readers on my system using WMI. They're all connected via USB, so I query the WMI registry for all Win32_PnPEntitys. But I have no clue how to determine which devices are 'card readers'. Here's what I already have:

ManagementObjectSearcher mos =
new ManagementObjectSearcher(@"\root\cimv2", @"Select * From Win32_PnPEntity");

ManagementObjectCollection mob = mos.Get();

foreach (ManagementObject mo in mob)
{
    Console.WriteLine("DeviceID: " + mo["DeviceID"].ToString());
    Console.WriteLine("Service: " + mo["Service"].ToString());
}

我不能只过滤设备名称,阅读器的品牌/型号不同,也没有共同点.在设备管理器"中,它们都归在智能卡读卡器"下,因此必须有另一种方法.

I can't just filter on the device name, there's different brands/models of readers, and there's no common denominator. In the Device Manager they're all grouped under 'smart card readers', so there must be a(nother) way.

推荐答案

我在

Smart Card Readers
Class = SmartCardReader
ClassGuid = {50dd5230-ba8a-11d1-bf5d-0000f805f530}
This class includes smart card readers.

所以最后我想到了这个:

So finally I came up with this:

ManagementObjectSearcher mos = new ManagementObjectSearcher(@"\root\cimv2",
@"SELECT* FROM Win32_PnPEntity WHERE ClassGuid = '{50DD5230-BA8A-11D1-BF5D-0000F805F530}'");

似乎给了我我想要的东西:)

Which seems to give me what I want :)

这篇关于如何通过WMI将所有智能卡读卡器安装到系统上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆