Click here to Skip to main content
15,884,944 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am now working on a project which related to bluetooth communication.
I retrieved all COM ports names "COM12" , "COM23" from devices "Dual-SPP" and "SOLONOID" , now my problem is I could get information related to device like "DeviceID", "Friendly name" , but i need to get the above actual names of device like
"Dual-SPP" and "SOLONOID".

How do i get this names? please suggest.
Thanks .

What I have tried:

ManagementObjectSearcher searcher =
                   new ManagementObjectSearcher("root\\CIMV2",
                   "SELECT * FROM Win32_PnPEntity");

               foreach (ManagementObject ManObj in searcher.Get())
               {
                   if (ManObj["Caption"].ToString().Contains("(COM"))
                   {
                       Console.WriteLine(ManObj["DeviceID"].ToString());
                       Console.WriteLine(ManObj["PNPDeviceID"].ToString());
                       Console.WriteLine(ManObj["Name"].ToString());
                       Console.WriteLine(ManObj["Caption"].ToString());
                       Console.WriteLine(ManObj["Description"].ToString());
                       Console.WriteLine(ManObj["ProviderType"].ToString());
                       Console.WriteLine(ManObj["Status"].ToString());
                   }
               }
Posted
Updated 19-Sep-16 22:17pm

1 solution

What makes you think they have an "actual name" like "solonoid" which is machine readable?
The "friendly name" is the name it reports to Windows as a "human friendly" description of the device, and is probably about the best you can hope for.
There is Win32_SerialPort class (Windows)[^] which includes a "description" property, but the chances are that is the same as friendly name anyway (in fact it's probably teh source of the "friendly name" that ManagementObject returns).
 
Share this answer
 
Comments
Member 11543226 20-Sep-16 5:06am    
that properties i already got in my code above. but is there any way to get that name.

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