Findong number of Com ports on a machine

  • Thread starter Thread starter rollasoc
  • Start date Start date
R

rollasoc

Hi,

Anyone know a way of working out the total number and which COM ports exist
on a machine, using C#?

rollasoc
 
rollasoc,

Using the classes in the System.Management namespace, I would do a query
for all instances of Win32_SerialPort. This will return the information
about the port, as well as the number of ports on the system.

Hope this helps.
 
Thank you Nicholas.

Nicholas Paldino said:
rollasoc,

Using the classes in the System.Management namespace, I would do a query
for all instances of Win32_SerialPort. This will return the information
about the port, as well as the number of ports on the system.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

rollasoc said:
Hi,

Anyone know a way of working out the total number and which COM ports exist
on a machine, using C#?

rollasoc
 
Hi,

Ok, sussed how to find the 2 COM Ports on my motherboard ok, using
System.Management namespace and looking for Win32_SerialPort.

Problem now, is I have 3 COM Ports on USB connections, but can't seem to
find a way to query for them.

Any suggestions?

rollasoc


rollasoc said:
Thank you Nicholas.

message news:[email protected]...
rollasoc,

Using the classes in the System.Management namespace, I would do a query
for all instances of Win32_SerialPort. This will return the information
about the port, as well as the number of ports on the system.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

rollasoc said:
Hi,

Anyone know a way of working out the total number and which COM ports exist
on a machine, using C#?

rollasoc
 
Back
Top