Display Active Serial Comm? Ports, including USB adapters
- This topic has 4 replies, 2 voices, and was last updated 7 months, 1 week ago by Nigel.
5 May, 2019 at 12:51 am #1602Nigel
Hi, I have been trying to get DI to display the active serial port(s), so that when I plug in the USB adapter I know where to point putty to establish communications. I have had no success. I have tried the WMI function with MSSerial_PortName to catch instances of the USB virtual ports without success.
I wish I could turn on debug for a block of code in the ini file but DI does not seem to offer that functionality. Possible future feature request.
Any assistance will be appreciated.0
6 May, 2019 at 1:04 pm #1603GlennKeymaster
WMI Explorer is your friend.
I have a Prolific USB-to-Serial Comm Port:
It shows up in MSSerial_PortName if I “Run As Admin”
It doesn’t show in win32_SerialPort at all.
It shows up in Win32_PnPEntity without requiring admin access. But because this is a list of all PNP devices, i have to set a where clause to isolate it and then there’s no single property showing the COM port, it’s tacked on the end of the caption which may get cropped on the display.
Win32_PnPEntity where pnpclass=”Ports”
Win32_PnPEntity where name like “%(COM%”
I’d like to use the DeviceID property to query MSSerial_PortName for the COM port but that requires escaping certain characters which DTI doesn’t do.
So, right now, the closest I can get is either:
namespace:root\cimv2,query:Win32_PnPEntity where name like “%(COM%”
which requires Admin access. While it’s not ideal, it does give you the vital clues of USB and COM port.1+
7 May, 2019 at 9:12 am #1604GlennKeymaster
All of the above is Win10 1803. I note that MSSerial_PortName doesn’t seem to work at all on my Win7 Pro box.0
9 May, 2019 at 8:15 am #1605Nigel
Thanks Glenn, I used the information you provided, and I came up with this for my Win7 Pro box, and, it works for me. Thanks for the help, this gives me sufficient to start with. I now have to test against different USB serial adapters to see if it is consistent. Thanks for the help and the ideas for a solution.
The code I am using is as follows:
WMI=active:1,interval:60,color:88ff44:namespace:root\cimv2,query:Win32_PnPEntity where Description like “USB Serial Port”,display:%Caption%0
9 May, 2019 at 9:30 am #1606Nigel
Hi, first set of tests failed, slight modification of key word search works better. Needs more testing, apparently different manufactures adapters report different id strings and will have to be parsed differently.
WMI=active:1,interval:60,color:88ff44:namespace:root\cimv2,query:Win32_PnPEntity where Description like “%Serial% %Port%”,display:%Caption%