Pavel Radzivilovsky Pavel Radzivilovsky - 1 year ago 103
C# Question

How to open a serial port by friendly name?

friendly name = the name that appears in "Device Manager" under "Ports (COM & LPT).

EDIT: two solutions provided below. One with WMI and another with SetupAPI.

Answer Source

Try running a WMI query on the Win32_SerialPort class. Download WmiCodeCreator to experiment and auto-generate the C# code.