How can I get the date and version of drivers in C#?
This is my code, I can get name, description...
ManagementClass M开发者_JAVA百科gmtClass = new ManagementClass("Win32_SystemDriver");
foreach (ManagementObject mo in MgmtClass.GetInstances())
{
name=mo["Name"];
Dis=mo["Description"];
...
}
How can I get the date and version of drivers?
You should start from researching Win32_PnPSignedDriver Class and Win32_PnPEntity Class
EXAMPLE
ManagementObjectSearcher searcher =
new ManagementObjectSearcher("root\\CIMV2",
"SELECT * FROM Win32_PnPSignedDriver");
ManagementObjectCollection moc = searcher.Get();
foreach (var manObj in moc)
{
Console.WriteLine("Device Name: {0}\r\nDeviceID: {1}\r\nDriverDate: {2}\r\nDriverVersion: {3}\r\n==============================\r\n", manObj["FriendlyName"], manObj["DeviceID"], manObj["DriverDate"], manObj["DriverVersion"]);
}
精彩评论