TechTip: Display current COM ports on the system

Fewer and fewer laptops come equipped with the standard DB9 COM port which, while making sense for the average consumer, makes connecting to switch/firewall/appliance console ports increasingly difficult. Enter USB-to-serial converters. Personally I use the Aten UC232A USB-to-DB9 Serial Adapter but there is a great number of options out there. Just plug it in, get the drivers working, and you get a COM# port to use with your favorite terminal client (eg. PuTTY).

The only inconvenience of this whole workaround lies in the fact that all such USB adapters will give you a seemingly random COM port number to be used in the said terminal client. Usually I would go to the system device manager and check what number was assigned to the adapter, but that just takes too many clicks. So, following is a simple batch file that will output all COM ports present on the system, by polling the corresponding registry keys:

@echo off
reg query HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM | find "REG_SZ"
pause > nul

Above uses the built-in Windows Registry Tool so no additional applications or gadgets required. It should be easy to determine which port belongs to the USB adapter, but if all else fails, simply run the batch before and after putting the dongle into your laptop.

Update: good write-up on some alternative methods for reporting the COM-port number of your USB-to-DB9 adapter here.

1 comment:

Anonymous said...

very useful, just what i needed thanks