How do I clean out unwanted virtual COM ports?

  • Thread starter Thread starter MartyG
  • Start date Start date
M

MartyG

I have a hardware test project where I connect USB to Serial devices to my
computer. The devices have unique serial numbers and so each time different
device is plugged into my USB the New Hardware Wizard launches and assigns
the next available COM port number to the device. There are two things I want
to do:

1) I want to free up COMxx port numbers consumed by devices I will not see
again.

2) I want to control the assignment of COM port numbers in some automated
way (via my test software) to assign the port number I want.
 
"MartyG" wrote:

> I have a hardware test project where I connect USB to Serial devices to my
> computer. The devices have unique serial numbers and so each time different
> device is plugged into my USB the New Hardware Wizard launches and assigns
> the next available COM port number to the device. There are two things I want
> to do:
>
> 1) I want to free up COMxx port numbers consumed by devices I will not see
> again.
>
> 2) I want to control the assignment of COM port numbers in some automated
> way (via my test software) to assign the port number I want.



I am having the exact same problem, has anyone responded?
 
"Alphaxi" <Alphaxi@discussions.microsoft.com> wrote in message
news:6337D9D2-1685-41B2-832E-0582B4E92564@microsoft.com...
>
>
> "MartyG" wrote:
>
>> I have a hardware test project where I connect USB to Serial devices to
>> my
>> computer. The devices have unique serial numbers and so each time
>> different
>> device is plugged into my USB the New Hardware Wizard launches and
>> assigns
>> the next available COM port number to the device. There are two things I
>> want
>> to do:
>>
>> 1) I want to free up COMxx port numbers consumed by devices I will not
>> see
>> again.


Why would you expect Windows to know what devices you will not see again?


>> 2) I want to control the assignment of COM port numbers in some automated
>> way (via my test software) to assign the port number I want.


That would be a feature of the test software, which is telling Windows what
port to create. Windows is not dictating the port number, except for
blocking in-use ports.

Properly designed software should remove the virtual port when it shuts
down. It should not orphan those ports.

You might consider contacting the publisher of the test software for a
solution, since it is the behaviour of *that* software that you're asking
about, not Windows. Windows is just doing what it's told to do.

HTH
-pk

> I am having the exact same problem, has anyone responded?
 
When windows detects a device on a USB port it runs the found new hardware
wizard and puts information in the registry. If I have a parade of devices
with unique serial numbers the registry grows and grows with clutter. The
problem is even worse when the devices are USB to serial devices that are
assigned the next available COM port as well. I have avoided the problem in
my test by not allowing the device to re-register with windows after
assigning a unique serial number. However if the device is re-tested it will
want to run the found new hardware wizard and add to the registry.

Again my question is how do I clean out the unwanted clutter from the
registry and clear COM ports tagged as in-use? It does not seem wise to just
guess at what registry values apply and start hacking with regedit.

Is there an elegant way to undo what the found new hardware wizard does?
Is there a place to find out what is changed in the registry if I have to do
it the hard way, (especially where COM ports are flagged as in-use)?

"Patrick Keenan" wrote:

> "Alphaxi" <Alphaxi@discussions.microsoft.com> wrote in message
> news:6337D9D2-1685-41B2-832E-0582B4E92564@microsoft.com...
> >
> >
> > "MartyG" wrote:
> >
> >> I have a hardware test project where I connect USB to Serial devices to
> >> my
> >> computer. The devices have unique serial numbers and so each time
> >> different
> >> device is plugged into my USB the New Hardware Wizard launches and
> >> assigns
> >> the next available COM port number to the device. There are two things I
> >> want
> >> to do:
> >>
> >> 1) I want to free up COMxx port numbers consumed by devices I will not
> >> see
> >> again.

>
> Why would you expect Windows to know what devices you will not see again?


I know the devices are gone for good and I want to pass this gem of
knowledge on to windows to remove clutter and free consumed resources.


>
>
> >> 2) I want to control the assignment of COM port numbers in some automated
> >> way (via my test software) to assign the port number I want.

>
> That would be a feature of the test software, which is telling Windows what
> port to create. Windows is not dictating the port number, except for
> blocking in-use ports.


Windows does indeed choose the next available port without asking any
advice. I can reassign the port to a lower number and ignore the warning but
mostly I want to be able to clean the clutter out that has already collected.

>
> Properly designed software should remove the virtual port when it shuts
> down. It should not orphan those ports.
>
> You might consider contacting the publisher of the test software for a
> solution, since it is the behavior of *that* software that you're asking
> about, not Windows. Windows is just doing what it's told to do.


The problem I am having is independent of any software other than windows.
The port itself is not left open. The add hardware wizard leaves stuff in the
registry that I would like to clean out. Are the registry mods known only to
the author of the device driver?

>
> HTH
> -pk
>
> > I am having the exact same problem, has anyone responded?

>
>
>
 
Remove them in Device Manager.

MartyG wrote:

> When windows detects a device on a USB port it runs the found new hardware
> wizard and puts information in the registry. If I have a parade of devices
> with unique serial numbers the registry grows and grows with clutter. The
> problem is even worse when the devices are USB to serial devices that are
> assigned the next available COM port as well. I have avoided the problem in
> my test by not allowing the device to re-register with windows after
> assigning a unique serial number. However if the device is re-tested it will
> want to run the found new hardware wizard and add to the registry.
>
> Again my question is how do I clean out the unwanted clutter from the
> registry and clear COM ports tagged as in-use? It does not seem wise to just
> guess at what registry values apply and start hacking with regedit.
>
> Is there an elegant way to undo what the found new hardware wizard does?
> Is there a place to find out what is changed in the registry if I have to do
> it the hard way, (especially where COM ports are flagged as in-use)?
>
> "Patrick Keenan" wrote:
>
>
>>"Alphaxi" <Alphaxi@discussions.microsoft.com> wrote in message
>>news:6337D9D2-1685-41B2-832E-0582B4E92564@microsoft.com...
>>
>>>
>>>"MartyG" wrote:
>>>
>>>
>>>>I have a hardware test project where I connect USB to Serial devices to
>>>>my
>>>>computer. The devices have unique serial numbers and so each time
>>>>different
>>>>device is plugged into my USB the New Hardware Wizard launches and
>>>>assigns
>>>>the next available COM port number to the device. There are two things I
>>>>want
>>>>to do:
>>>>
>>>>1) I want to free up COMxx port numbers consumed by devices I will not
>>>>see
>>>>again.

>>
>>Why would you expect Windows to know what devices you will not see again?

>
>
> I know the devices are gone for good and I want to pass this gem of
> knowledge on to windows to remove clutter and free consumed resources.
>
>
>
>>
>>>>2) I want to control the assignment of COM port numbers in some automated
>>>>way (via my test software) to assign the port number I want.

>>
>>That would be a feature of the test software, which is telling Windows what
>>port to create. Windows is not dictating the port number, except for
>>blocking in-use ports.

>
>
> Windows does indeed choose the next available port without asking any
> advice. I can reassign the port to a lower number and ignore the warning but
> mostly I want to be able to clean the clutter out that has already collected.
>
>
>>Properly designed software should remove the virtual port when it shuts
>>down. It should not orphan those ports.
>>
>>You might consider contacting the publisher of the test software for a
>>solution, since it is the behavior of *that* software that you're asking
>>about, not Windows. Windows is just doing what it's told to do.

>
>
> The problem I am having is independent of any software other than windows.
> The port itself is not left open. The add hardware wizard leaves stuff in the
> registry that I would like to clean out. Are the registry mods known only to
> the author of the device driver?
>
>
>>HTH
>>-pk
>>
>>
>>>I am having the exact same problem, has anyone responded?

>>
>>
>>
 
Well I found a solution that works for me. I recreated the bluetooth
connection and let it selected whatever port it wanted to, I went to control
panel and then clicked the 'system' icon

clicked on the 'hardware' tab
clicked 'device manager'
went under 'ports' and

right clicked on the bluetooth connection and went to properties. Under the
'advanced' tab I clicked on each com port marked 'in use' that I knew was not
and changed the bluetooth connection to each of those ports one by one. This
clears the port of being marked 'in use'. When I finished I selected the
port I wanted the bluetooth connection on and I rebooted the machine and all
of the ports are know free and my connection is on the port I want it on.

I know you are looking for something more automated, but that's what I came
up with.



"Bob I" wrote:

> Remove them in Device Manager.
>
> MartyG wrote:
>
> > When windows detects a device on a USB port it runs the found new hardware
> > wizard and puts information in the registry. If I have a parade of devices
> > with unique serial numbers the registry grows and grows with clutter. The
> > problem is even worse when the devices are USB to serial devices that are
> > assigned the next available COM port as well. I have avoided the problem in
> > my test by not allowing the device to re-register with windows after
> > assigning a unique serial number. However if the device is re-tested it will
> > want to run the found new hardware wizard and add to the registry.
> >
> > Again my question is how do I clean out the unwanted clutter from the
> > registry and clear COM ports tagged as in-use? It does not seem wise to just
> > guess at what registry values apply and start hacking with regedit.
> >
> > Is there an elegant way to undo what the found new hardware wizard does?
> > Is there a place to find out what is changed in the registry if I have to do
> > it the hard way, (especially where COM ports are flagged as in-use)?
> >
> > "Patrick Keenan" wrote:
> >
> >
> >>"Alphaxi" <Alphaxi@discussions.microsoft.com> wrote in message
> >>news:6337D9D2-1685-41B2-832E-0582B4E92564@microsoft.com...
> >>
> >>>
> >>>"MartyG" wrote:
> >>>
> >>>
> >>>>I have a hardware test project where I connect USB to Serial devices to
> >>>>my
> >>>>computer. The devices have unique serial numbers and so each time
> >>>>different
> >>>>device is plugged into my USB the New Hardware Wizard launches and
> >>>>assigns
> >>>>the next available COM port number to the device. There are two things I
> >>>>want
> >>>>to do:
> >>>>
> >>>>1) I want to free up COMxx port numbers consumed by devices I will not
> >>>>see
> >>>>again.
> >>
> >>Why would you expect Windows to know what devices you will not see again?

> >
> >
> > I know the devices are gone for good and I want to pass this gem of
> > knowledge on to windows to remove clutter and free consumed resources.
> >
> >
> >
> >>
> >>>>2) I want to control the assignment of COM port numbers in some automated
> >>>>way (via my test software) to assign the port number I want.
> >>
> >>That would be a feature of the test software, which is telling Windows what
> >>port to create. Windows is not dictating the port number, except for
> >>blocking in-use ports.

> >
> >
> > Windows does indeed choose the next available port without asking any
> > advice. I can reassign the port to a lower number and ignore the warning but
> > mostly I want to be able to clean the clutter out that has already collected.
> >
> >
> >>Properly designed software should remove the virtual port when it shuts
> >>down. It should not orphan those ports.
> >>
> >>You might consider contacting the publisher of the test software for a
> >>solution, since it is the behavior of *that* software that you're asking
> >>about, not Windows. Windows is just doing what it's told to do.

> >
> >
> > The problem I am having is independent of any software other than windows.
> > The port itself is not left open. The add hardware wizard leaves stuff in the
> > registry that I would like to clean out. Are the registry mods known only to
> > the author of the device driver?
> >
> >
> >>HTH
> >>-pk
> >>
> >>
> >>>I am having the exact same problem, has anyone responded?
> >>
> >>
> >>

>
>
 
Most of my clutter is from devices that are no longer around so they don't
show up in device manager. I could probably recreate devices with the same
serial number etc. and make them show up in device manager. It would take
some time but may be worth while. As for new devices that come and go, would
WMI or something like it allow me to pole at device manager to remove devices
via a script?

"Bob I" wrote:

> Remove them in Device Manager.
>
>
 
They should be visible if you tick "Show Hidden Devices" in "View"

MartyG wrote:

> Most of my clutter is from devices that are no longer around so they don't
> show up in device manager. I could probably recreate devices with the same
> serial number etc. and make them show up in device manager. It would take
> some time but may be worth while. As for new devices that come and go, would
> WMI or something like it allow me to pole at device manager to remove devices
> via a script?
>
> "Bob I" wrote:
>
>
>>Remove them in Device Manager.
>>
>>
 
Back
Top