46

How do I clean-up these in-use COM ports? enter image description here

The COM port numbers always seem to be taken up by something and although right now I only have 4 serial ports (3 over Bluetooth and one USB to RS-232), I have numerous COM ports set as in use. I'd like to clean that list up a bit.

Also it seems to me that from time to time, one of the taken COM ports gets freed up and then one of the devices I use will take that number creating confusion, since I'll have to go and hunt its com number in device manager.

UPDATE:

Well I just cleaned up countless USB devices that once were connected to the computer using USBDeview and still the problem still remains.

9 Answers 9

45

Run Device Manager from elevated command line:

> set DEVMGR_SHOW_NONPRESENT_DEVICES=1
> devmgmt.msc

Enable "Show hidden devices" in the menu, and uninstall grayed-out COM ports.

5
  • 2
    The hidden serial ports don't seem the be the main cause of the issue. As expected, I found numerous instances of serial ports created by my USB to RS-232 adapter, but even when they are cleaned up, I still have 11 extra COM ports set as in use.
    – AndrejaKo
    Apr 5, 2012 at 17:52
  • 2
    @AndrejaKo: Do you have any devices listed under "Modems"? They also take up 1 serial port each. Apr 5, 2012 at 17:54
  • Yes, but there's just one modem there.
    – AndrejaKo
    Apr 5, 2012 at 18:02
  • 1
    This works, but setting the system variable as seen in answer @Michael Herman is IMHO better way and the view in the Device Manager "show hidden devices" works afterwards. I don't know why MS has disabled that system variable on my PC per default. Jun 16, 2017 at 9:35
  • This worked for me on Windows 7 64 bit Enterprise Edition from an elevated command prompt
    – Trevor
    Jan 19, 2018 at 17:11
31

I found a useful answer at How to clear or Reset COM port ?

  1. Click start → Run → type regedit and click OK button
  2. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\COM Name Arbiter
  3. Now on the right panel, you can see the key ComDB. Right-click it and click modify
  4. In value Data section select all and delete reset to zero (0)
    Its 32 bytes with 8 bits in each byte in hexadecimal representation. A bit of value 1 makes a port number (1...256) reserved. The first 8 ports are in two leftmost hexadecimal values, bits ascending from lowest to highest right to left, the next 8 ports are in the second two and so on: hex F3 24 would be binary 1111 0011 0010 0100, which means that following ports are used: 1, 2, 5, 6, 7, 8 (1111 0011) and 11, 14 (0010 0100). enter image description here
  5. Close the registry editor and then restart your computer. If you set the value to 0 all COM ports are free.

You may need to reinstall any USB-to-serial converter.

9
  • 1
    Welcome to superuser. I edited your answer and added some more details. Free feel to rollback your post if needed.
    – nixda
    Jul 4, 2013 at 21:40
  • Looks interesting! I'll try it out and report the results.
    – AndrejaKo
    Jul 4, 2013 at 21:44
  • No, I followed this exactly and it didn't remove any of them. Feb 4, 2015 at 0:34
  • @nixda isnt it 1,2,5,6,7,8,11,14?
    – kimliv
    Aug 18, 2016 at 16:44
  • @kimliv I did not insert that part of the answer. That was the editor after me :) So you have to ask him
    – nixda
    Aug 18, 2016 at 17:46
16

Thanks for all the advice above. I wrote software to automatically clean up the Registry but though it did adjust the Hardware, Software, and Arbiter sections it did NOT remove the phantom COM port entries. Even a reboot with the "USB to 2Serial Port" device removed did not clean up the system properly.

However, the instructions on this PDF did work correctly:

For Win7, I adjusted the instructions slightly on that PDF to be:

  1. click Start / (right click:) Computer / Properties / Advanced System Settings (not Device Manager)
  2. Click Environment Variables
  3. Click in the System variables (bottom section) click New
  4. Enter Variable Name: DEVMGR_SHOW_NONPRESENT_DEVICES
    Enter Variable Value: 1
  5. Click OK (exits Environment)
  6. Click OK (exits System Properties)

  7. Click Start. In the command box, type Manage This shows the Computer Management window ...

  8. Click Device Manager
  9. Click View and select Show Hidden Devices
  10. Click Ports (COM & LPT)
    Now all the ports, real (black text) and phantom (grayed out text) appear.
  11. One by one, right click the phantom ports, and select Uninstall

This should now have cleared out your system of unwanted phantom USB ports.

Note: after cleaning out all my phantom ports, leaving only "COM1", I find my Registry shows:

Hardware:   COM1
Software:   COM1, COM2, COM3, COM4, COM5
Arbiter:    COM1, COM2, COM3

And a right click on Computer / Properties / Device Manager / Ports shows only COM1. Right click on COM1 / Properties / Port Settings / Advanced shows COM1 with COM2 "in use" and COM3 "in use". All the other settings up to 7 that used to be "in use" are now freed up. So only the "Arbiter" setting seems to be telling the Win7 system what is really "in use". The Computer Management system has cleaned up the Arbiter, but not cleaned up the Software section...

... many are the mysteries of Microsoft...

5
  • This submission has far to many formatting errors for my taste. Feel free to spend some time formatting your submission and I will reverse my vote.
    – Ramhound
    Oct 13, 2015 at 16:30
  • 1
    surprised that this answer doesn't have upvotes, as it is the only answer that actually solved my problem on Win7
    – bas
    Jan 8, 2016 at 9:27
  • Wow I had loads of mapped unused ports. Although Ive never had any problem mapping to an 'in use' port, its nice housekeeping.
    – Ninga
    Sep 18, 2017 at 21:46
  • PDF Broken link. Where in the registry is "Hardware, software arbiter"? Are there any other instructions that should be carried over but were lost to the PDF? May 21, 2018 at 19:06
  • 1
    Dead link from this reply available from archive: web.archive.org/web/20110605124602/http://www.istime.com/istdnn/…
    – pol098
    Jul 2, 2022 at 14:04
8

Resolving USB driver issues

Method Using Elevated Command Prompt

ie type cmd in search bar then right click cmd.exe selecting Run as Administrator

• 1st stage As discussed from command prompt type; set devmgr_show_non_present_devices=1 devmgmt.msc

    Under Ports (Com & LPT) delete all instances of  prolific USB to Serial Comm Port

• 2nd Stage Again from Elevated Command Prompt - Remove Driver Packages from drivers store. The driver store is a protected area of the computer that contains device driver packages that have been approved for installation on the computer

    You need to Identify OEM#.inf  where # is a number so type 
        pnputil.exe -e      (then enter)

    Read the entries in the output to find the description of your package(s) and its file name(s)


    Its highly likely you will have multiple entries from previous attempts.

Note all oem###.inf instances of the prolific driver where # (hash) is the number.

    To remove entries type:
        pnputil.exe -d  oem###.inf

(use space between exe & - and d & Oem then press enter) Remember to replace # with the number of the inf file you want to delete.

If the computer reports that the driver package is in use by a currently installed device, then you must either uninstall the device first, or use the -f on the pnputil command to force deletion of the package.

Also you may have driver package loaded on as program that may need removal using control panel/programs/uninstall a program.

If you do all that before loading the correct driver package and try to keep the Com device inserted in the same port rather than moving it around your ports you will have fewer problems with the Prolific driver.

2

I have a simple solution that worked for me... my count was up to 45 com ports in use!

1) Open Device Manager

2) From the View menu, select 'Show Hidden Devices'

3) Expand 'Ports (COM & LPT)' category from the list

4) Right-click on all the devices and remove them (no need to tick to delete the driver)

5) From the Action menu, select 'Scan for New Devices'

6) Viola! All the actual devices will be re-allocated from COM1

3
  • 1
    voila not viola
    – Jason S
    Jun 9, 2016 at 20:51
  • This has already been proposed in an existing upvoted answer.
    – guest
    Apr 3, 2018 at 16:02
  • (1) It's shorter. (2) "Don't need to delete the driver" is useful info. (3) May not always work, but being simple, it's easy to try first. (x) I only needed to free up one port to put it in range of the program that "only went to 24" :)
    – gbarry
    May 12, 2021 at 16:42
2

I found that this tool works excellently for this issue.

Device Remover https://www.majorgeeks.com/files/details/device_remover_543c.html

Just load it up, click on "Display Mode", "Show only hidden/detached devices", Check "Ports" (which selects all the unused com ports), then click "Remove all checked", and confirm the removal when the warning appears.

Cheers!

~Andrew

EmpoweringSolutions.net

0

These did not work for me. But official Microsoft help page worked for me.

From https://support.microsoft.com/en-us/kb/222018

  • In the Printers folder, click Server Properties on the File menu.
  • Click the Ports tab, click the port you want to remove, click Delete Port, and then click OK.
2
  • 1
    Does this actually work for serial ports, on Windows 7? Also, you're supposed to summarize the link contents in your answer, instead of just providing the link, in case link rot happens.
    – AndrejaKo
    Jun 14, 2016 at 13:15
  • Link rot happened - linked page does not exist anymore
    – sdbbs
    Jul 18, 2019 at 6:59
-1

(For those who came from google)

If previos answer doesn't work and has installed windows mobile 6 SDK. It may be problem with XPVCOM.SYS (this driver reserved 14 COM ports) To uninstall in console

CD \Program Files\Windows Mobile 6 SDK\Tools\Cellular Emulator\

InstallXPVCom.exe UnInstall

then reboot.

0
-1

For those who do not want to use the CMD line interface I use this in Windows 7.

  1. Open Control Panel
  2. Select "SYSTEM" from the menu
  3. Select "ADVANCED SYSTEM SETTINGS" on the left
  4. Select "ENVIRONMENT VARIABLES" on the bottom right of the box
  5. Look for "DEVMGR_SHOW_NONPRESENT_DEVICES" in the System Variables list. If it is not there create it and assign it a variable value of
    1. Back out with OK, OK, OK. You are now back in the Control panel screen.
  6. Select "Device Manager" and go to "View"
  7. Select "Show Hidden Devices" and all hidden devices including the Comm ports will be shown greyed out or Ghosted.
  8. Select the ones you want to remove, right click and select "Uninstall"
1
  • 3
    This has already been proposed in an existing upvoted answer.
    – guest
    Apr 3, 2018 at 15:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .