Pavel Radzivilovsky Pavel Radzivilovsky - 4 days ago 6
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

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

Comments