How to get information from device manager?

Afra picture Afra · Aug 4, 2011 · Viewed 9.6k times · Source

How can I, in my C# applictation, read specific information about a device? I have tried WMI and it does not provide the information that I need.

The information that I want is stored in the Details tab of a device and the information I want there is "Parent".

I have also looked in regedit, without any luck.

Answer

Ben Voigt picture Ben Voigt · Aug 4, 2011

Microsoft provides a sample: http://support.microsoft.com/kb/311272

From C#, it might be easier to capture the output of devcon than integrating the APIs. If you feel comfortable with it, C++/CLI is by far the easiest way to get device information into .NET (I've done this before).