count COM Ports


Rainer Borchmann


how can i count how many COM ports avaible on a Device ?
I have here on may table a Dell who has COM 0 to COM9 =10 ports
and some ports are named GPD1 to GPD9 , i dont know whats that.
And a Toshiba e 800 who has also 8 COM Ports.

how can i count how many COM ports avaible on a Device with
C# ?




Paul G. Tobey [eMVP]

There's no way to do that with 100% reliability on 100% of devices. Of
course, you can enumerate through the registry branch at HKLM/Drivers/Active
and see which ones named COMx: there are.

Some of our devices are capable of being extended beyond 9 COM ports and I
chose SER as the prefix for the next 10 and ASY for the 10 after that, but
those were just strings that I came up with.

Here's an older thread where there is some code I wrote, not managed code,
of course, to count up COM ports. There's also a suggestion there from
Steve Maillet about checking with RAS for serial ports, so maybe that will
help you.

Paul T.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

COM Port 4
COM Ports 4
list COM port 1
Detecting Com Ports 0
COM Port disappears 7
Com port scanning 1
COM Port Delete 1
Virtual COM Port 12