Removing Hidden COM & LPT Ports and Devices on Windows

These days machines do not have physical serial (COM) ports any more. I do not understand why the USB group had missed to define a clean serial communication standard :-(. And the same mistake gets repeated for BLE again 😦 :-(. So every vendor and provider has its own USB CDC driver and interface. And it is really a big pain of the virtual COM/USB CDC ports installed. I have seen countless cases where “the USB UART or CDC port does not work”. So if you have such a problem, I might have a tip for you: Show hidden devices in the Windows Device manager. But in a special way I had not thought about it!

Where are the hidden devices

Where are the hidden devices?

Thanks to a tip from Mike S. (thank you again, Mike!), I was able to solve a strange COM port on my machine which I had with mbed serial ports. But that trick can help you with any other kind of serial port.

Show Hidden Devices?

In the Windows Device Manager, there is an option to show hidden devices:

Show Hidden Devices

Show Hidden Devices

Well, I *thought* that in the past this was doing what is supposed to do: to show hidden devices. But when I turn that option on, I get this:

Showing Hidden Devices or not

Showing Hidden Devices or not?

Do you see the problem? No? Well, it seems that I do not have any hidden Ports? Well, actually not true. The problem I have faced somehow that the serial virtual port has been assigned a high port number causing it to crash. But I do not see the reason for such a high port number?

Show the hidden devices

There is a Microsoft technical article about this problem: https://support.microsoft.com/en-us/kb/315539. So the solution is:

  1. Run cmd.exe as administrator
  2. Execute the following command to set an environment variable:
    set devmgr_show_nonpresent_devices=1
  3. Execute the following command to launch the Device Manager with that setting:
    start devmgmt.msc
Started Device Manager from DOS Cmd

Started Device Manager from DOS Cmd

And now look at THIS (hidden devices shown grayed out):

Showing Hidden Devices in Windows Device Manager

Showing Hidden Devices in Windows Device Manager

I had over 200 (!!!!!) mbed Serial Ports listed. Yikes!!!!

Now with the devices visible, I was able to uninstall them. I had to reboot my machine afterwards too, but now my virtual serial ports was working properly :-).

💡 As mentioned in the comments of this post, the need for having for each USB CDC device on Windows seems to be a Windows specific problem. E.g. for the Freescale USB CDC devices I do not need a driver, all what I need is a .inf file with correct device/vendor ID. But other vendors (including mbed) are indeed providing their own serial driver, which on its own is a problem: that driver is not really necessary.

Summary

I don’t know since when I’m not able to see hidden devices in the Windows Device Manager any more, and maybe the University IT department has pushed such a setting to my machine. But using above trick I’m able to see and uninstall/remove all these ghost/hidden devices to have a clean state. And after rebooting my serial port problem went away 🙂

Happy Unhiding 🙂

12 thoughts on “Removing Hidden COM & LPT Ports and Devices on Windows

  1. If I remember correctly, I used restart into “safe mode” (Restart PC and press F8 before the Windows logo appears) in the past. In safe mode I was able remove “inactive” drivers (for devices which are currently not connected) and restart back to normal mode.

    Unfortunately restart into “safe mode” won’t work at my company PC now. It works correctly.

    Thank you very much for this new solution.
    BR
    Radek

    Like

  2. The problem isn’t with USB, but with Windows. On Linux and Mac OS X, there are fairly standard USB serial drivers that just work. The problem seems to be that Windows relies on vendor and product id, rather than device type to figure out how to talk to a device, so every device gets its own driver, even if it is identical to every other device of that type.

    Like

    • Indeed, that’s a better explanation of that pain. Indeed, all what is needed on windows is a .inf with that vendor/product ID. I have to update my text, thanks for that insight :-).

      Like

    • On the other side: mbed provides indeed a special/custom serial port driver (other vendors might do the same, have not checked them all). Again for mbed it is a Windows problem: if you disconnect a board with the COM port open, that COM driver remains open/blocked. To ‘fix’ that, mbed engineers at ARM have decided to implement their own driver. I have been told that Windows 10 should have this problem solved, but as I do not have Windows 10, I cannot verify this.

      Like

  3. Thanks, Erich. I’ve been struggling with the virtual serial port on my new Freedom board for days. This finally fixed it!!!

    Like

  4. On my Windows 7, if there are no active ports (there are none on the motherboard, so any / all have to come from USB), then Device Manager doesn’t even show the Ports category. The ‘set’ command mentioned doesn’t seem to affect that aspect.

    Like

    • On my Windows 7 machine, I do not have physical COM or LPT ports. But I do have that group listed in my device manager. Maybe some settings by your IT management/group settings? Do you have it listed if you boot in ‘safe’ mode?

      Like

  5. You saved my a** with this after being stuck in a kind of “bootloop” due to a bluescreen after login (made my way out with the hints above in safe mode).
    I was puzzled by the same thing: show hidden devices in the GUI doesn’t show everything. And I needed to get rid of a peripheral bluetooth device.
    Thank you!

    Like

    • Glad to hear that this was helpful. And yes, I have used that trick for a bluescreen issue too, but this was whenever I plugged in the (virtual) COM device. Clearing all devices rescued that situation for me too.

      Like

What do you think?

This site uses Akismet to reduce spam. Learn how your comment data is processed.