By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,707 Members | 839 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,707 IT Pros & Developers. It's quick & easy.

Finding/Listing usb/bluetooth/... serial-ports with System.Management.dll[reposted from microsoft.public.dotnet.framework.sdk, microsoft.public.dotnet.framework.wmi]

P: n/a

Having posted in microsoft.public.dotnet.framework.sdk and
microsoft.public.dotnet.framework.wmi without receiving any response, I
posthere on the off-chance that someone who isn't following those groups
knows a solution.

I'm using code (roughly like):

using System;
using System.Management;
public class Foo {
public static void Main() {
foreach ( ManagementObject port
in new ManagementClass("Win32_SerialPort").GetInstances() )
Console.WriteLine("{0}: {1}", port["deviceid"], port["name"]);

To query for the serial ports present on a system.

Unfortunatly, this doesn't seem to include COM-ports available via
usb-adapters or bluetooth. These devices are visible in the
DeviceManager in System->Hardware->DeviceManager->Ports (COM & LPT), and
I want to get the same list as that, just without the LPT ports.

What am I doing wrong?

I had trouble finding info on the web, so here's something for the
search engines to catch on for the benefit of the next guy.

Keywords: com, com-port, serial-port, WMI, System.Management, .NET, C#,
enumerating, listing, finding, searching, win32, windows, win32api)

Helge Jensen
-=> Sebastian cover-music: <=-
Jul 22 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.