Question

I'm detecting the insertion of memory cards (removable media). Can I get information about the inserted media - type, manufacturer, etc?

Was it helpful?

Solution

You ought to be able to use WMI to query the Win32_PhysicalMedia type and get the information you want.

Here is a basic code example of how to do a general query on the class:

ManagementObjectSearcher searcher = new
    ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia");

foreach (ManagementObject wmiObject in searcher.Get())
{
    if (wmiObject["Manufacturer"] == null)
        Console.WriteLine("Unknown");
    else
        Console.WriteLine(wmiObject["Manufacturer"].ToString());
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top