WMI Win32_PnPSignedDriver is not refreshed or updated.

  • Thread starter Thread starter Joh Chen
  • Start date Start date
J

Joh Chen

Guest
Hi,

I've have been struggling for almost 2 weeks to detect why if my code is incorrect for the above mentioned issue. My objective is to detect the hard disk information base on the location info from Win32_PnPSignedDriver. However, i only notice that the class from Win32_PnPSignedDriver is not updated when i plugged my hard disk into a hot plug bay.

However, i noted that if i am using another application, the wmi returning correct value. The application took more than 5 minutes for the wmi to get refreshed.


Btw, i am using this as windows host service mode.

Below would be the snippet of my code. Any help on this matter is very much appreciated.


var psDiskSearcher = new ManagementObjectSearcher(PnPSignedDriverDiskQueryConst + " WHERE DeviceName = 'Disk drive'");
psDiskSearcher.Scope = new ManagementScope(@"\root\cimv2");
iDriveIndex = 0;
List<ManagementObject> managementPnPSignedDriverList = psDiskSearcher.Get().Cast<ManagementObject>().ToList();
managementPnPSignedDriverList = managementPnPSignedDriverList.OrderBy(p => p.Properties["DeviceID"].Value).ToList();
foreach (var drive in managementPnPSignedDriverList)
{
dicDrives[iDriveIndex].Location = (string)drive["Location"];
iDriveIndex++;
}

Continue reading...
 
Back
Top