Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
As we go to device manager it shows us a Node (MODEMS) that are connected to our pc. How to get all com port no. and name of each modem connected to my pc in c# win. form.

I have already tried
mSearch = new ManagementObjectSearcher("Select * from Win32_SerialPort"); 

and
mSearch = new ManagementObjectSearcher("Select * from Win32_POTSModem"); 


but 1 out of 15 pc's does not shows result.

Thanks In Advance.
Posted
Updated 29-Jan-14 6:47am
v2
Comments
Vedat Ozan Oner 26-Jan-14 7:29am    
there is a good example here: http://stackoverflow.com/questions/3331043/get-list-of-connected-usb-devices
Sergey Alexandrovich Kryukov 26-Jan-14 21:35pm    
Yes, but OP asks about serial-port devices...
—SA
Sergey Alexandrovich Kryukov 26-Jan-14 21:36pm    
Are you sure those modems are installed on these 15 PCs? What are the differences between those systems. These days, having a COM port is a pretty rare thing...
—SA
agent_kruger 27-Jan-14 6:15am    
every pc has usb drivers installed and modem's software is installed too.
[no name] 29-Jan-14 20:02pm    
You have edited the question without adding anything. The question is too general. 1 out of 15 pcs? Are they all running the same OS? Are you testing the same device on all pcs? Can you see the modem in device manager in all pcs? You are the guy at the coalface. We cannot guess what you are seeing. You need to be extremely clear about your problem.

 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 26-Jan-14 23:17pm    
Agree, I thought the same way. My 5.
—SA
Please see my comment to the question. Maybe you need another WMI class, "Win32_POTSModem": http://msdn.microsoft.com/en-us/library/aa394360%28v=vs.85%29.aspx[^].

See also these classes:
http://msdn.microsoft.com/en-us/library/aa394354%28v=vs.85%29.aspx[^],
http://msdn.microsoft.com/en-us/library/aa394361%28v=vs.85%29.aspx[^].

—SA
 
Share this answer
 
Comments
[no name] 26-Jan-14 23:13pm    
More explanation from OP would help but I think this is the path.
Sergey Alexandrovich Kryukov 26-Jan-14 23:16pm    
Agree, than you very much.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900