Finding serial ports


Senior Member
Hi All,

I have always had the problem of figuring out which COM port number is assigned to which USB-RS232 adapter.
Now this has bugged me for a number of years until a friend of my son stated, "yeah no problem. Use PowerShell", in Windows OS.

Anyway, he started me off, and in the end I have resolved the mission, yes I did choose to accept it! :p

To get into PowerShell, in the Command Line type "powershell".
Takes a while to show up, but you'll see the standard prompt with PS in-front of it. Then enter "gwmi Win32_PnPEntity -Filter "PNPCLASS='PORTS'" | select name" (everything between the outer "). Keep all the spaces EXACTLY as they are shown.
You should now have a table of Comm Ports (and an LPT port (at least on my PC without a LPT being available?)).

Realistically, no-one wants to have to remember that line just to get the Comm Port numbers. It's about the same time as going into Device Manager and finding out from there!

So what to do??
Search on-line and download a program called PowerGUI. With this, the PowerShell script can be made into an EXE file. Can't remember how I did that, but if I can do it, you can too;).

This can then be saved in a convenient folder, make a shortcut to the desktop. I found the first time was problematic with my AntiVirus, but after that had no issues.
This has been tested to work in Win10.

I hope this helps someone out there in PICAXE land.:D


Where you query (?) the presence of an LPT (line printer) port on your PC that may be entirely possible even if the is no printer parallel port on the back of the case.
The mother board may still have the basic hardware on-board.

We have 5 set up desktop PC's at home plus a range of portable devices and many visitors seem to have a portable /laptop when here.

Of the desktop machines (all running Win 10 now) two are older HP Z400 XEON based workstation machines (originally licensed as Win7 Pro 64-bit OS)
The mother board on these has sockets for LPT and an RS-232 9-on serial port.
The serial port is about a 16-pin boxed header and you need to buy the HP cable with the actual 9-pin socket as the socket has a small PCB wigth a level shifting/buffer IC onboard. I actually picked up one of the HP cables for a few $ from EBay as I do need an RS-232 serial port (not a USB to serial adapter) for a couple of older applications/hardware.


Senior Member
The query is for Plug-N-Play Ports, listed by name.
I only mention the LPT as it did show up, but as a surprise. I do know it's not really there (physically). :eek:

You do know that you can set up a USB adapter and remap to COM1?
Especially useful for older software, and I've used it to set up a programming cable on DOS programs using DOSBox.
In some DOS software, you'll be lucky to get more options than 2 COM ports.