I am trying to get the media devices in a PC that are enabled. I can use WMI to get the list of devices, however there doesn't seem to be a property identifying if the device is enabled or not (I am referring to the devices' status in Device Manager).
I am currently using this code to get the list of devices which works well. However if the user has disabled the device, it is still returned by this list and my application tries to use it, but obviously cannot be used...
private static ManagementObjectCollection GetMediaDevices()
{
ManagementObjectSearcher objSearcher =
new ManagementObjectSearcher("SELECT HardwareID FROM Win32_PnPSignedDriver Where DeviceClass = 'MEDIA'");
return objSearcher.Get();
}
I have looked at all the properties (SELECT *
) but none seem to have this information.
Any ideas?