如何读取设备和驱动程序版本 [英] How to read devices and driver versions

查看:164
本文介绍了如何读取设备和驱动程序版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难弄清楚该怎么做。基本上,我要做的就是阅读连接到计算机的所有设备,并阅读驱动程序制造商和设备驱动程序的版本。这是您可以在设备管理器中获得的信息,但我想以编程方式进行操作。

I'm having a really hard time figuring out how to do this. Basically, all I want to do is read all the devices that are attached to the machine and also read the driver manufacturer and version of the device driver. This is the information you can get in the device manager,but I want to do it programattically.

我已经做了很多搜索和阅读,但无法找到任何可以帮助我做到这一点的东西。有WMI的东西应该起作用,但是我找不到任何有效的示例。我已经阅读并阅读了有关WMI的内容,但仍然无法弄清楚。

I've done a lot of searching and reading, and can't find anything that helps me do this. There is this WMI stuff that should work, but I can't find any examples that work. I've read and read about WMI, but still can't figure it out.

有没有教程可以比Microsoft网站更好地解释WMI?我需要将其降低到绘儿乐水平。

Are there any tutorials out there that might explain WMI better than the Microsoft site? I need this to be down be to the crayola level.

推荐答案

请查看以下文章

使用C#获取硬件信息

从Windows Management Instrumentation检索信息

编辑:

我相信您正在寻找以下 Win32_PnPSignedDriver

I believe that you are looking for the following Win32_PnPSignedDriver class

public class Program
{
    public static void Main()
    {
        ManagementObjectSearcher objSearcher = new ManagementObjectSearcher("Select * from Win32_PnPSignedDriver");

        ManagementObjectCollection objCollection = objSearcher.Get();

        foreach (ManagementObject obj in objCollection)
        {
            string info = String.Format("Device='{0}',Manufacturer='{1}',DriverVersion='{2}' ", obj["DeviceName"], obj["Manufacturer"], obj["DriverVersion"]);
            Console.Out.WriteLine(info);
        }

        Console.Write("\n\nAny key...");
        Console.ReadKey();
    }
}

Aslo,如果您要做很​​多工作您也可以使用WMI来避免创建测试应用程序。

Aslo, if you are going to work a lot on WMI you might as well use this tool, to avoid creating test applications.

  • WMI Code Creator v1.0

这篇关于如何读取设备和驱动程序版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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